diff --git a/arcgis-go b/arcgis-go index e47b350f..c2a9e981 160000 --- a/arcgis-go +++ b/arcgis-go @@ -1 +1 @@ -Subproject commit e47b350f9231a16c815b927947f9d718cec2d3fe +Subproject commit c2a9e9811f3f4fcf5b5c030788dd03fa5e2f748d diff --git a/arcgis.go b/arcgis.go index c045610b..d71ff60a 100644 --- a/arcgis.go +++ b/arcgis.go @@ -14,12 +14,14 @@ import ( "net/http" "net/url" "os" + "sort" "strconv" "strings" "sync" "time" "github.com/Gleipnir-Technology/arcgis-go" + "github.com/Gleipnir-Technology/arcgis-go/fieldseeker" "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/Gleipnir-Technology/nidus-sync/sql" "github.com/aarondl/opt/omit" @@ -154,10 +156,19 @@ func updateArcgisUserData(ctx context.Context, user *models.User, access_token s } for _, result := range search.Results { slog.Info("Got result", slog.String("name", result.Name)) - //if result.Name == "FieldseekerGIS" { - //slog.Info("Found Fieldseeker", slog.String("url", result.URL)) - //} + if result.Name == "FieldSeekerGIS" { + slog.Info("Found Fieldseeker", slog.String("url", result.URL)) + setter := models.OrganizationSetter{ + FieldseekerURL: omitnull.From(result.URL), + } + err = org.Update(ctx, PGInstance.BobDB, &setter) + if err != nil { + slog.Error("Failed to create new organization", slog.String("err", err.Error())) + return + } + } } + NewOAuthTokenChannel <- struct{}{} } func handleOauthAccessCode(ctx context.Context, user *models.User, code string) error { @@ -195,7 +206,6 @@ func handleOauthAccessCode(ctx context.Context, user *models.User, code string) return fmt.Errorf("Failed to save token to database: %v", err) } go updateArcgisUserData(context.Background(), user, token.AccessToken, accessExpires, token.RefreshToken, refreshExpires) - NewOAuthTokenChannel <- struct{}{} return nil } @@ -228,6 +238,7 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) { maintainOAuth(workerCtx, oauth) }() } + select { case <-ctx.Done(): slog.Info("Exiting refresh worker...") @@ -242,6 +253,82 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) { } } +func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature) (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) + } + slog.Info("Starting on layer", slog.String("name", layer.Name), slog.Int("id", layer.ID)) + if count.Count == 0 { + return inserts, updates, nil + } + for { + if offset >= count.Count { + break + } + query := arcgis.NewQuery() + query.ResultRecordCount = fssync.MaxRecordCount() + query.ResultOffset = offset + query.SpatialReference = "4326" + query.OutFields = "*" + query.Where = "1=1" + qr, err := fssync.DoQuery( + 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) + } + i, u, err := saveOrUpdateDBRecords(ctx, "FS_"+layer.Name, qr) + if err != nil { + saveRawQuery(fssync, layer, query, "failure.json") + return 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 +} + +func exportFieldseekerData(ctx context.Context, oauth *models.OauthToken) error { + slog.Info("Update Fieldseeker data") + ar := arcgis.NewArcGIS( + arcgis.AuthenticatorOAuth{ + AccessToken: oauth.AccessToken, + AccessTokenExpires: oauth.AccessTokenExpires, + RefreshToken: oauth.RefreshToken, + RefreshTokenExpires: oauth.RefreshTokenExpires, + }, + ) + row, err := sql.OrgByOauthId(oauth.ID).One(ctx, PGInstance.BobDB) + if err != nil { + return fmt.Errorf("Failed to get org ID: %v", err) + } + fssync, err := fieldseeker.NewFieldSeeker( + ar, + row.FieldseekerURL.MustGet(), + ) + if err != nil { + return fmt.Errorf("Failed to create fssync: %v", err) + } + inserts := 0 + updates := 0 + for _, layer := range fssync.FeatureServerLayers() { + i, u, err := downloadAllRecords(ctx, fssync, layer) + if err != nil { + return fmt.Errorf("Failed to get layer %s: %v", layer, err) + } + inserts += i + updates += u + } + + return nil +} + func maintainOAuth(ctx context.Context, oauth *models.OauthToken) { refreshDelay := time.Until(oauth.AccessTokenExpires) slog.Info("Need to refresh oauth", slog.Int("id", int(oauth.ID)), slog.Float64("seconds", refreshDelay.Seconds())) @@ -251,14 +338,26 @@ func maintainOAuth(ctx context.Context, oauth *models.OauthToken) { slog.Error("Failed to refresh token", slog.String("err", err.Error())) return } + refreshDelay = time.Until(oauth.AccessTokenExpires) } - ticker := time.NewTicker(refreshDelay) + refreshTicker := time.NewTicker(refreshDelay) + pollTicker := time.NewTicker(1) for { select { case <-ctx.Done(): return - case <-ticker.C: - + case <-refreshTicker.C: + err := refreshOAuth(ctx, oauth) + if err != nil { + 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) } } @@ -283,18 +382,16 @@ func refreshOAuth(ctx context.Context, oauth *models.OauthToken) error { return fmt.Errorf("Failed to handle request: %v", err) } accessExpires := futureUTCTimestamp(token.ExpiresIn) - refreshExpires := futureUTCTimestamp(token.RefreshTokenExpiresIn) setter := models.OauthTokenSetter{ - AccessToken: omit.From(token.AccessToken), - AccessTokenExpires: omit.From(accessExpires), - RefreshToken: omit.From(token.RefreshToken), - RefreshTokenExpires: omit.From(refreshExpires), - Username: omit.From(token.Username), + AccessToken: omit.From(token.AccessToken), + AccessTokenExpires: omit.From(accessExpires), + Username: omit.From(token.Username), } err = oauth.Update(ctx, PGInstance.BobDB, &setter) if err != nil { return fmt.Errorf("Failed to update oauth in database: %v", err) } + slog.Info("Updated oauth token", slog.Int("oauth token id", int(oauth.ID))) return nil } @@ -382,3 +479,358 @@ func saveResponse(data []byte, filename string) { } slog.Info("Wrote response", slog.String("filename", filename)) } + +func saveRawQuery(fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature, query *arcgis.Query, filename string) { + output, err := os.Create(filename) + if err != nil { + slog.Error("Failed to create file", slog.String("filename", filename)) + return + } + qr, err := fssync.DoQueryRaw( + layer.ID, + query) + if err != nil { + slog.Error("Failed to do query", slog.String("err", err.Error())) + return + } + _, err = output.Write(qr) + if err != nil { + slog.Error("Failed to write results", slog.String("err", err.Error())) + return + } + slog.Info("Wrote failed query", slog.String("filename", filename)) +} + +func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryResult) (int, int, error) { + inserts, updates := 0, 0 + sorted_columns := make([]string, 0, len(qr.Fields)) + for _, f := range qr.Fields { + sorted_columns = append(sorted_columns, f.Name) + } + sort.Strings(sorted_columns) + + objectids := make([]int, 0) + for _, l := range qr.Features { + oid := l.Attributes["OBJECTID"].(float64) + objectids = append(objectids, int(oid)) + } + + rows_by_objectid, err := rowmapViaQuery(ctx, table, sorted_columns, objectids) + if err != nil { + return inserts, updates, fmt.Errorf("Failed to get existing rows: %v", err) + } + // log.Println("Rows from query", len(rows_by_objectid)) + + for _, feature := range qr.Features { + oid := feature.Attributes["OBJECTID"].(float64) + row := rows_by_objectid[int(oid)] + // 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 { + 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 { + return inserts, updates, fmt.Errorf("Failed to update row: %v", err) + } + updates += 1 + } + } + return inserts, updates, nil +} + +// Produces a map of OBJECTID to a 'row' which is in turn a map of column names to their values as strings +func rowmapViaQuery(ctx context.Context, table string, sorted_columns []string, objectids []int) (map[int]map[string]string, error) { + result := make(map[int]map[string]string) + + query := selectAllFromQueryResult(table, sorted_columns) + + args := pgx.NamedArgs{ + "objectids": objectids, + } + rows, err := PGInstance.PGXPool.Query(ctx, query, args) + if err != nil { + return result, fmt.Errorf("Failed to query rows: %v", err) + } + defer rows.Close() + + // +2 for geometry x and geometry x + columnNames := make([]string, len(sorted_columns)+2) + for i, c := range sorted_columns { + columnNames[i] = c + } + columnNames[len(sorted_columns)] = "geometry_x" + columnNames[len(sorted_columns)+1] = "geometry_y" + + rowSlice, err := pgx.CollectRows(rows, func(row pgx.CollectableRow) (map[string]string, error) { + fieldDescriptions := row.FieldDescriptions() + values := make([]interface{}, len(fieldDescriptions)) + valuePtrs := make([]interface{}, len(fieldDescriptions)) + + for i := range values { + valuePtrs[i] = &values[i] + } + + if err := row.Scan(valuePtrs...); err != nil { + return nil, err + } + + result := make(map[string]string) + for i, fd := range fieldDescriptions { + if values[i] != nil { + result[fd.Name] = fmt.Sprintf("%v", values[i]) + //log.Printf("col %v type %T val %v", fd.Name, values[i], values[i]) + } else { + result[fd.Name] = "" + } + } + + return result, nil + }) + if err != nil { + return result, fmt.Errorf("Failed to collect rows: %v", err) + } + for _, row := range rowSlice { + o := row["objectid"] + objectid, err := strconv.Atoi(o) + if err != nil { + return result, fmt.Errorf("Failed to parse objectid %s: %v", o, err) + } + result[objectid] = row + } + return result, nil +} + +func insertRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) 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) + if err != nil { + transaction.Rollback(ctx) + return fmt.Errorf("Unable to insert FS: %v", err) + } + + err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, 1) + if err != nil { + transaction.Rollback(ctx) + return fmt.Errorf("Failed to insert history: %v", err) + } + + err = transaction.Commit(ctx) + if err != nil { + return fmt.Errorf("Failed to commit transaction: %v", err) + } + return nil +} + +func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature) error { + // Create the query to produce the main row + var sb strings.Builder + sb.WriteString("INSERT INTO ") + sb.WriteString(table) + sb.WriteString(" (") + for _, field := range sorted_columns { + sb.WriteString(field) + sb.WriteString(",") + } + // Specially add the geometry values since they aren't in the fields + sb.WriteString("geometry_x,geometry_y,updated") + sb.WriteString(")\nVALUES (") + for _, field := range sorted_columns { + sb.WriteString("@") + sb.WriteString(field) + sb.WriteString(",") + } + // Specially add the geometry values since they aren't in the fields + sb.WriteString("@geometry_x,@geometry_y,@updated)") + + args := pgx.NamedArgs{} + for k, v := range feature.Attributes { + args[k] = v + } + // 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["updated"] = time.Now() + + _, err := transaction.Exec(ctx, sb.String(), args) + if err != nil { + return fmt.Errorf("Failed to insert row into %s: %v", table, err) + } + return nil +} +func hasUpdates(row map[string]string, feature arcgis.Feature) bool { + for key, value := range feature.Attributes { + rowdata := row[strings.ToLower(key)] + // We'll accept any 'nil' as represented by the empty string in the database + if value == nil { + if rowdata == "" { + continue + } else if len(rowdata) > 0 { + return true + } else { + slog.Error("Looks like our original value is nil, but our row value is something non-empty with a zero length. Need a programmer to look into this.") + } + } + // check strings first, their simplest + if featureAsString, ok := value.(string); ok { + if featureAsString != rowdata { + return true + } + continue + } else if featureAsInt, ok := value.(int); ok { + // Previously had a nil value, now we have a real value + if rowdata == "" { + return true + } + rowAsInt, err := strconv.Atoi(rowdata) + if err != nil { + slog.Error(fmt.Sprintf("Failed to convert '%s' to an int to compare against %v for %v", rowdata, featureAsInt, key)) + } + if rowAsInt != featureAsInt { + return true + } else { + continue + } + } else if featureAsFloat, ok := value.(float64); ok { + // Previously had a nil value, now we have a real value + if rowdata == "" { + return true + } + rowAsFloat, err := strconv.ParseFloat(rowdata, 64) + if err != nil { + slog.Error(fmt.Sprintf("Failed to convert '%s' to a float64 to compare against %v for %v", rowdata, featureAsFloat, key)) + } + if rowAsFloat != featureAsFloat { + return true + } else { + continue + } + } + slog.Info(fmt.Sprintf("key: %s\tvalue: %v (type %T)\trow: %s\n", key, value, value, rowdata)) + slog.Error("we've hit a point where we can't tell if we have an update or not, need a programmer to look at the above") + } + return false +} +func updateRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) error { + // Get the current highest version for the row in question + history_table := toHistoryTable(table) + var sb strings.Builder + sb.WriteString("SELECT MAX(version) FROM ") + sb.WriteString(history_table) + sb.WriteString(" WHERE OBJECTID=@objectid") + + args := pgx.NamedArgs{} + o := feature.Attributes["OBJECTID"].(float64) + args["objectid"] = int(o) + + var version int + if err := PGInstance.PGXPool.QueryRow(ctx, sb.String(), args).Scan(&version); err != nil { + return fmt.Errorf("Failed to query for version: %v", err) + } + + var options pgx.TxOptions + transaction, err := PGInstance.PGXPool.BeginTx(ctx, options) + if err != nil { + return fmt.Errorf("Unable to start transaction") + } + + err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, version+1) + if err != nil { + transaction.Rollback(ctx) + return fmt.Errorf("Failed to insert history: %v", err) + } + err = updateRowFromFeatureFS(ctx, transaction, table, sorted_columns, feature) + if err != nil { + transaction.Rollback(ctx) + return fmt.Errorf("Failed to update row from feature: %v", err) + } + + err = transaction.Commit(ctx) + if err != nil { + return fmt.Errorf("Failed to commit transaction: %v", err) + } + return nil +} +func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, version int) error { + history_table := toHistoryTable(table) + var sb strings.Builder + sb.WriteString("INSERT INTO ") + sb.WriteString(history_table) + sb.WriteString(" (") + for _, field := range sorted_columns { + sb.WriteString(field) + sb.WriteString(",") + } + // Specially add the geometry values since they aren't in the fields + sb.WriteString("created,geometry_x,geometry_y,version") + sb.WriteString(")\nVALUES (") + for _, field := range sorted_columns { + sb.WriteString("@") + sb.WriteString(field) + sb.WriteString(",") + } + // Specially add the geometry values since they aren't in the fields + sb.WriteString("@created,@geometry_x,@geometry_y,@version)") + args := pgx.NamedArgs{} + for k, v := range feature.Attributes { + args[k] = v + } + args["created"] = time.Now() + 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) + } + return nil +} +func selectAllFromQueryResult(table string, sorted_columns []string) string { + var sb strings.Builder + sb.WriteString("SELECT * FROM ") + sb.WriteString(table) + sb.WriteString(" WHERE OBJECTID=ANY(@objectids)") + return sb.String() +} +func toHistoryTable(table string) string { + return "History_" + table[3:len(table)] +} + +func updateRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature) error { + // Create the query to produce the main row + var sb strings.Builder + sb.WriteString("UPDATE ") + sb.WriteString(table) + sb.WriteString(" SET ") + for _, field := range sorted_columns { + // OBJECTID is special as our primary key, so skip it + if field == "OBJECTID" { + continue + } + sb.WriteString(field) + sb.WriteString("=@") + sb.WriteString(field) + sb.WriteString(",") + } + // Specially add the geometry values since they aren't in the fields + sb.WriteString("geometry_x=@geometry_x,geometry_y=@geometry_y,updated=@updated WHERE OBJECTID=@OBJECTID") + + args := pgx.NamedArgs{} + for k, v := range feature.Attributes { + args[k] = v + } + // 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["updated"] = time.Now() + + _, err := transaction.Exec(ctx, sb.String(), args) + if err != nil { + return fmt.Errorf("Failed to update row into %s: %v", table, err) + } + return nil +} diff --git a/dberrors/fs_containerrelate.bob.go b/dberrors/fs_containerrelate.bob.go new file mode 100644 index 00000000..8515c169 --- /dev/null +++ b/dberrors/fs_containerrelate.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 FSContainerrelateErrors = &fsContainerrelateErrors{ + ErrUniqueFsContainerrelatePkey: &UniqueConstraintError{ + schema: "", + table: "fs_containerrelate", + columns: []string{"objectid"}, + s: "fs_containerrelate_pkey", + }, +} + +type fsContainerrelateErrors struct { + ErrUniqueFsContainerrelatePkey *UniqueConstraintError +} diff --git a/dberrors/fs_fieldscoutinglog.bob.go b/dberrors/fs_fieldscoutinglog.bob.go new file mode 100644 index 00000000..827cfb69 --- /dev/null +++ b/dberrors/fs_fieldscoutinglog.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 FSFieldscoutinglogErrors = &fsFieldscoutinglogErrors{ + ErrUniqueFsFieldscoutinglogPkey: &UniqueConstraintError{ + schema: "", + table: "fs_fieldscoutinglog", + columns: []string{"objectid"}, + s: "fs_fieldscoutinglog_pkey", + }, +} + +type fsFieldscoutinglogErrors struct { + ErrUniqueFsFieldscoutinglogPkey *UniqueConstraintError +} diff --git a/dberrors/fs_habitatrelate.bob.go b/dberrors/fs_habitatrelate.bob.go new file mode 100644 index 00000000..a201f0af --- /dev/null +++ b/dberrors/fs_habitatrelate.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 FSHabitatrelateErrors = &fsHabitatrelateErrors{ + ErrUniqueFsHabitatrelatePkey: &UniqueConstraintError{ + schema: "", + table: "fs_habitatrelate", + columns: []string{"objectid"}, + s: "fs_habitatrelate_pkey", + }, +} + +type fsHabitatrelateErrors struct { + ErrUniqueFsHabitatrelatePkey *UniqueConstraintError +} diff --git a/dberrors/fs_inspectionsample.bob.go b/dberrors/fs_inspectionsample.bob.go new file mode 100644 index 00000000..eb1c67fc --- /dev/null +++ b/dberrors/fs_inspectionsample.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 FSInspectionsampleErrors = &fsInspectionsampleErrors{ + ErrUniqueFsInspectionsamplePkey: &UniqueConstraintError{ + schema: "", + table: "fs_inspectionsample", + columns: []string{"objectid"}, + s: "fs_inspectionsample_pkey", + }, +} + +type fsInspectionsampleErrors struct { + ErrUniqueFsInspectionsamplePkey *UniqueConstraintError +} diff --git a/dberrors/fs_inspectionsampledetail.bob.go b/dberrors/fs_inspectionsampledetail.bob.go new file mode 100644 index 00000000..88bb551e --- /dev/null +++ b/dberrors/fs_inspectionsampledetail.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 FSInspectionsampledetailErrors = &fsInspectionsampledetailErrors{ + ErrUniqueFsInspectionsampledetailPkey: &UniqueConstraintError{ + schema: "", + table: "fs_inspectionsampledetail", + columns: []string{"objectid"}, + s: "fs_inspectionsampledetail_pkey", + }, +} + +type fsInspectionsampledetailErrors struct { + ErrUniqueFsInspectionsampledetailPkey *UniqueConstraintError +} diff --git a/dberrors/fs_linelocation.bob.go b/dberrors/fs_linelocation.bob.go new file mode 100644 index 00000000..4992a2af --- /dev/null +++ b/dberrors/fs_linelocation.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 FSLinelocationErrors = &fsLinelocationErrors{ + ErrUniqueFsLinelocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_linelocation", + columns: []string{"objectid"}, + s: "fs_linelocation_pkey", + }, +} + +type fsLinelocationErrors struct { + ErrUniqueFsLinelocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_locationtracking.bob.go b/dberrors/fs_locationtracking.bob.go new file mode 100644 index 00000000..ff9d7a16 --- /dev/null +++ b/dberrors/fs_locationtracking.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 FSLocationtrackingErrors = &fsLocationtrackingErrors{ + ErrUniqueFsLocationtrackingPkey: &UniqueConstraintError{ + schema: "", + table: "fs_locationtracking", + columns: []string{"objectid"}, + s: "fs_locationtracking_pkey", + }, +} + +type fsLocationtrackingErrors struct { + ErrUniqueFsLocationtrackingPkey *UniqueConstraintError +} diff --git a/dberrors/fs_mosquitoinspection.bob.go b/dberrors/fs_mosquitoinspection.bob.go new file mode 100644 index 00000000..538874b9 --- /dev/null +++ b/dberrors/fs_mosquitoinspection.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 FSMosquitoinspectionErrors = &fsMosquitoinspectionErrors{ + ErrUniqueFsMosquitoinspectionPkey: &UniqueConstraintError{ + schema: "", + table: "fs_mosquitoinspection", + columns: []string{"objectid"}, + s: "fs_mosquitoinspection_pkey", + }, +} + +type fsMosquitoinspectionErrors struct { + ErrUniqueFsMosquitoinspectionPkey *UniqueConstraintError +} diff --git a/dberrors/fs_pointlocation.bob.go b/dberrors/fs_pointlocation.bob.go new file mode 100644 index 00000000..2257af9e --- /dev/null +++ b/dberrors/fs_pointlocation.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 FSPointlocationErrors = &fsPointlocationErrors{ + ErrUniqueFsPointlocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_pointlocation", + columns: []string{"objectid"}, + s: "fs_pointlocation_pkey", + }, +} + +type fsPointlocationErrors struct { + ErrUniqueFsPointlocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_polygonlocation.bob.go b/dberrors/fs_polygonlocation.bob.go new file mode 100644 index 00000000..0c878aee --- /dev/null +++ b/dberrors/fs_polygonlocation.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 FSPolygonlocationErrors = &fsPolygonlocationErrors{ + ErrUniqueFsPolygonlocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_polygonlocation", + columns: []string{"objectid"}, + s: "fs_polygonlocation_pkey", + }, +} + +type fsPolygonlocationErrors struct { + ErrUniqueFsPolygonlocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_pool.bob.go b/dberrors/fs_pool.bob.go new file mode 100644 index 00000000..bb0df722 --- /dev/null +++ b/dberrors/fs_pool.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 FSPoolErrors = &fsPoolErrors{ + ErrUniqueFsPoolPkey: &UniqueConstraintError{ + schema: "", + table: "fs_pool", + columns: []string{"objectid"}, + s: "fs_pool_pkey", + }, +} + +type fsPoolErrors struct { + ErrUniqueFsPoolPkey *UniqueConstraintError +} diff --git a/dberrors/fs_pooldetail.bob.go b/dberrors/fs_pooldetail.bob.go new file mode 100644 index 00000000..9a1fa47a --- /dev/null +++ b/dberrors/fs_pooldetail.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 FSPooldetailErrors = &fsPooldetailErrors{ + ErrUniqueFsPooldetailPkey: &UniqueConstraintError{ + schema: "", + table: "fs_pooldetail", + columns: []string{"objectid"}, + s: "fs_pooldetail_pkey", + }, +} + +type fsPooldetailErrors struct { + ErrUniqueFsPooldetailPkey *UniqueConstraintError +} diff --git a/dberrors/fs_proposedtreatmentarea.bob.go b/dberrors/fs_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..16908ce4 --- /dev/null +++ b/dberrors/fs_proposedtreatmentarea.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 FSProposedtreatmentareaErrors = &fsProposedtreatmentareaErrors{ + ErrUniqueFsProposedtreatmentareaPkey: &UniqueConstraintError{ + schema: "", + table: "fs_proposedtreatmentarea", + columns: []string{"objectid"}, + s: "fs_proposedtreatmentarea_pkey", + }, +} + +type fsProposedtreatmentareaErrors struct { + ErrUniqueFsProposedtreatmentareaPkey *UniqueConstraintError +} diff --git a/dberrors/fs_qamosquitoinspection.bob.go b/dberrors/fs_qamosquitoinspection.bob.go new file mode 100644 index 00000000..2f43b453 --- /dev/null +++ b/dberrors/fs_qamosquitoinspection.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 FSQamosquitoinspectionErrors = &fsQamosquitoinspectionErrors{ + ErrUniqueFsQamosquitoinspectionPkey: &UniqueConstraintError{ + schema: "", + table: "fs_qamosquitoinspection", + columns: []string{"objectid"}, + s: "fs_qamosquitoinspection_pkey", + }, +} + +type fsQamosquitoinspectionErrors struct { + ErrUniqueFsQamosquitoinspectionPkey *UniqueConstraintError +} diff --git a/dberrors/fs_rodentlocation.bob.go b/dberrors/fs_rodentlocation.bob.go new file mode 100644 index 00000000..dd17e17b --- /dev/null +++ b/dberrors/fs_rodentlocation.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 FSRodentlocationErrors = &fsRodentlocationErrors{ + ErrUniqueFsRodentlocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_rodentlocation", + columns: []string{"objectid"}, + s: "fs_rodentlocation_pkey", + }, +} + +type fsRodentlocationErrors struct { + ErrUniqueFsRodentlocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_samplecollection.bob.go b/dberrors/fs_samplecollection.bob.go new file mode 100644 index 00000000..71660e3c --- /dev/null +++ b/dberrors/fs_samplecollection.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 FSSamplecollectionErrors = &fsSamplecollectionErrors{ + ErrUniqueFsSamplecollectionPkey: &UniqueConstraintError{ + schema: "", + table: "fs_samplecollection", + columns: []string{"objectid"}, + s: "fs_samplecollection_pkey", + }, +} + +type fsSamplecollectionErrors struct { + ErrUniqueFsSamplecollectionPkey *UniqueConstraintError +} diff --git a/dberrors/fs_samplelocation.bob.go b/dberrors/fs_samplelocation.bob.go new file mode 100644 index 00000000..1c54fd28 --- /dev/null +++ b/dberrors/fs_samplelocation.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 FSSamplelocationErrors = &fsSamplelocationErrors{ + ErrUniqueFsSamplelocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_samplelocation", + columns: []string{"objectid"}, + s: "fs_samplelocation_pkey", + }, +} + +type fsSamplelocationErrors struct { + ErrUniqueFsSamplelocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_servicerequest.bob.go b/dberrors/fs_servicerequest.bob.go new file mode 100644 index 00000000..7a95d4ab --- /dev/null +++ b/dberrors/fs_servicerequest.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 FSServicerequestErrors = &fsServicerequestErrors{ + ErrUniqueFsServicerequestPkey: &UniqueConstraintError{ + schema: "", + table: "fs_servicerequest", + columns: []string{"objectid"}, + s: "fs_servicerequest_pkey", + }, +} + +type fsServicerequestErrors struct { + ErrUniqueFsServicerequestPkey *UniqueConstraintError +} diff --git a/dberrors/fs_speciesabundance.bob.go b/dberrors/fs_speciesabundance.bob.go new file mode 100644 index 00000000..9661dce4 --- /dev/null +++ b/dberrors/fs_speciesabundance.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 FSSpeciesabundanceErrors = &fsSpeciesabundanceErrors{ + ErrUniqueFsSpeciesabundancePkey: &UniqueConstraintError{ + schema: "", + table: "fs_speciesabundance", + columns: []string{"objectid"}, + s: "fs_speciesabundance_pkey", + }, +} + +type fsSpeciesabundanceErrors struct { + ErrUniqueFsSpeciesabundancePkey *UniqueConstraintError +} diff --git a/dberrors/fs_stormdrain.bob.go b/dberrors/fs_stormdrain.bob.go new file mode 100644 index 00000000..ac616098 --- /dev/null +++ b/dberrors/fs_stormdrain.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 FSStormdrainErrors = &fsStormdrainErrors{ + ErrUniqueFsStormdrainPkey: &UniqueConstraintError{ + schema: "", + table: "fs_stormdrain", + columns: []string{"objectid"}, + s: "fs_stormdrain_pkey", + }, +} + +type fsStormdrainErrors struct { + ErrUniqueFsStormdrainPkey *UniqueConstraintError +} diff --git a/dberrors/fs_timecard.bob.go b/dberrors/fs_timecard.bob.go new file mode 100644 index 00000000..aade2db0 --- /dev/null +++ b/dberrors/fs_timecard.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 FSTimecardErrors = &fsTimecardErrors{ + ErrUniqueFsTimecardPkey: &UniqueConstraintError{ + schema: "", + table: "fs_timecard", + columns: []string{"objectid"}, + s: "fs_timecard_pkey", + }, +} + +type fsTimecardErrors struct { + ErrUniqueFsTimecardPkey *UniqueConstraintError +} diff --git a/dberrors/fs_trapdata.bob.go b/dberrors/fs_trapdata.bob.go new file mode 100644 index 00000000..f81ba3f6 --- /dev/null +++ b/dberrors/fs_trapdata.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 FSTrapdatumErrors = &fsTrapdatumErrors{ + ErrUniqueFsTrapdataPkey: &UniqueConstraintError{ + schema: "", + table: "fs_trapdata", + columns: []string{"objectid"}, + s: "fs_trapdata_pkey", + }, +} + +type fsTrapdatumErrors struct { + ErrUniqueFsTrapdataPkey *UniqueConstraintError +} diff --git a/dberrors/fs_traplocation.bob.go b/dberrors/fs_traplocation.bob.go new file mode 100644 index 00000000..b0b516f5 --- /dev/null +++ b/dberrors/fs_traplocation.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 FSTraplocationErrors = &fsTraplocationErrors{ + ErrUniqueFsTraplocationPkey: &UniqueConstraintError{ + schema: "", + table: "fs_traplocation", + columns: []string{"objectid"}, + s: "fs_traplocation_pkey", + }, +} + +type fsTraplocationErrors struct { + ErrUniqueFsTraplocationPkey *UniqueConstraintError +} diff --git a/dberrors/fs_treatment.bob.go b/dberrors/fs_treatment.bob.go new file mode 100644 index 00000000..7977b513 --- /dev/null +++ b/dberrors/fs_treatment.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 FSTreatmentErrors = &fsTreatmentErrors{ + ErrUniqueFsTreatmentPkey: &UniqueConstraintError{ + schema: "", + table: "fs_treatment", + columns: []string{"objectid"}, + s: "fs_treatment_pkey", + }, +} + +type fsTreatmentErrors struct { + ErrUniqueFsTreatmentPkey *UniqueConstraintError +} diff --git a/dberrors/fs_treatmentarea.bob.go b/dberrors/fs_treatmentarea.bob.go new file mode 100644 index 00000000..e676c1b5 --- /dev/null +++ b/dberrors/fs_treatmentarea.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 FSTreatmentareaErrors = &fsTreatmentareaErrors{ + ErrUniqueFsTreatmentareaPkey: &UniqueConstraintError{ + schema: "", + table: "fs_treatmentarea", + columns: []string{"objectid"}, + s: "fs_treatmentarea_pkey", + }, +} + +type fsTreatmentareaErrors struct { + ErrUniqueFsTreatmentareaPkey *UniqueConstraintError +} diff --git a/dberrors/fs_zones.bob.go b/dberrors/fs_zones.bob.go new file mode 100644 index 00000000..de8a0774 --- /dev/null +++ b/dberrors/fs_zones.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 FSZoneErrors = &fsZoneErrors{ + ErrUniqueFsZonesPkey: &UniqueConstraintError{ + schema: "", + table: "fs_zones", + columns: []string{"objectid"}, + s: "fs_zones_pkey", + }, +} + +type fsZoneErrors struct { + ErrUniqueFsZonesPkey *UniqueConstraintError +} diff --git a/dberrors/fs_zones2.bob.go b/dberrors/fs_zones2.bob.go new file mode 100644 index 00000000..bb8c7468 --- /dev/null +++ b/dberrors/fs_zones2.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 FSZones2Errors = &fsZones2Errors{ + ErrUniqueFsZones2Pkey: &UniqueConstraintError{ + schema: "", + table: "fs_zones2", + columns: []string{"objectid"}, + s: "fs_zones2_pkey", + }, +} + +type fsZones2Errors struct { + ErrUniqueFsZones2Pkey *UniqueConstraintError +} diff --git a/dberrors/history_containerrelate.bob.go b/dberrors/history_containerrelate.bob.go new file mode 100644 index 00000000..d05706df --- /dev/null +++ b/dberrors/history_containerrelate.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 HistoryContainerrelateErrors = &historyContainerrelateErrors{ + ErrUniqueHistoryContainerrelatePkey: &UniqueConstraintError{ + schema: "", + table: "history_containerrelate", + columns: []string{"objectid", "version"}, + s: "history_containerrelate_pkey", + }, +} + +type historyContainerrelateErrors struct { + ErrUniqueHistoryContainerrelatePkey *UniqueConstraintError +} diff --git a/dberrors/history_fieldscoutinglog.bob.go b/dberrors/history_fieldscoutinglog.bob.go new file mode 100644 index 00000000..d43668bf --- /dev/null +++ b/dberrors/history_fieldscoutinglog.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 HistoryFieldscoutinglogErrors = &historyFieldscoutinglogErrors{ + ErrUniqueHistoryFieldscoutinglogPkey: &UniqueConstraintError{ + schema: "", + table: "history_fieldscoutinglog", + columns: []string{"objectid", "version"}, + s: "history_fieldscoutinglog_pkey", + }, +} + +type historyFieldscoutinglogErrors struct { + ErrUniqueHistoryFieldscoutinglogPkey *UniqueConstraintError +} diff --git a/dberrors/history_habitatrelate.bob.go b/dberrors/history_habitatrelate.bob.go new file mode 100644 index 00000000..61be02f2 --- /dev/null +++ b/dberrors/history_habitatrelate.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 HistoryHabitatrelateErrors = &historyHabitatrelateErrors{ + ErrUniqueHistoryHabitatrelatePkey: &UniqueConstraintError{ + schema: "", + table: "history_habitatrelate", + columns: []string{"objectid", "version"}, + s: "history_habitatrelate_pkey", + }, +} + +type historyHabitatrelateErrors struct { + ErrUniqueHistoryHabitatrelatePkey *UniqueConstraintError +} diff --git a/dberrors/history_inspectionsample.bob.go b/dberrors/history_inspectionsample.bob.go new file mode 100644 index 00000000..7574296d --- /dev/null +++ b/dberrors/history_inspectionsample.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 HistoryInspectionsampleErrors = &historyInspectionsampleErrors{ + ErrUniqueHistoryInspectionsamplePkey: &UniqueConstraintError{ + schema: "", + table: "history_inspectionsample", + columns: []string{"objectid", "version"}, + s: "history_inspectionsample_pkey", + }, +} + +type historyInspectionsampleErrors struct { + ErrUniqueHistoryInspectionsamplePkey *UniqueConstraintError +} diff --git a/dberrors/history_inspectionsampledetail.bob.go b/dberrors/history_inspectionsampledetail.bob.go new file mode 100644 index 00000000..b0ed7ecd --- /dev/null +++ b/dberrors/history_inspectionsampledetail.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 HistoryInspectionsampledetailErrors = &historyInspectionsampledetailErrors{ + ErrUniqueHistoryInspectionsampledetailPkey: &UniqueConstraintError{ + schema: "", + table: "history_inspectionsampledetail", + columns: []string{"objectid", "version"}, + s: "history_inspectionsampledetail_pkey", + }, +} + +type historyInspectionsampledetailErrors struct { + ErrUniqueHistoryInspectionsampledetailPkey *UniqueConstraintError +} diff --git a/dberrors/history_linelocation.bob.go b/dberrors/history_linelocation.bob.go new file mode 100644 index 00000000..e3b2b1d9 --- /dev/null +++ b/dberrors/history_linelocation.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 HistoryLinelocationErrors = &historyLinelocationErrors{ + ErrUniqueHistoryLinelocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_linelocation", + columns: []string{"objectid", "version"}, + s: "history_linelocation_pkey", + }, +} + +type historyLinelocationErrors struct { + ErrUniqueHistoryLinelocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_locationtracking.bob.go b/dberrors/history_locationtracking.bob.go new file mode 100644 index 00000000..39ede938 --- /dev/null +++ b/dberrors/history_locationtracking.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 HistoryLocationtrackingErrors = &historyLocationtrackingErrors{ + ErrUniqueHistoryLocationtrackingPkey: &UniqueConstraintError{ + schema: "", + table: "history_locationtracking", + columns: []string{"objectid", "version"}, + s: "history_locationtracking_pkey", + }, +} + +type historyLocationtrackingErrors struct { + ErrUniqueHistoryLocationtrackingPkey *UniqueConstraintError +} diff --git a/dberrors/history_mosquitoinspection.bob.go b/dberrors/history_mosquitoinspection.bob.go new file mode 100644 index 00000000..a0f3dbdb --- /dev/null +++ b/dberrors/history_mosquitoinspection.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 HistoryMosquitoinspectionErrors = &historyMosquitoinspectionErrors{ + ErrUniqueHistoryMosquitoinspectionPkey: &UniqueConstraintError{ + schema: "", + table: "history_mosquitoinspection", + columns: []string{"objectid", "version"}, + s: "history_mosquitoinspection_pkey", + }, +} + +type historyMosquitoinspectionErrors struct { + ErrUniqueHistoryMosquitoinspectionPkey *UniqueConstraintError +} diff --git a/dberrors/history_pointlocation.bob.go b/dberrors/history_pointlocation.bob.go new file mode 100644 index 00000000..cd782c8c --- /dev/null +++ b/dberrors/history_pointlocation.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 HistoryPointlocationErrors = &historyPointlocationErrors{ + ErrUniqueHistoryPointlocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_pointlocation", + columns: []string{"objectid", "version"}, + s: "history_pointlocation_pkey", + }, +} + +type historyPointlocationErrors struct { + ErrUniqueHistoryPointlocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_polygonlocation.bob.go b/dberrors/history_polygonlocation.bob.go new file mode 100644 index 00000000..36b29190 --- /dev/null +++ b/dberrors/history_polygonlocation.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 HistoryPolygonlocationErrors = &historyPolygonlocationErrors{ + ErrUniqueHistoryPolygonlocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_polygonlocation", + columns: []string{"objectid", "version"}, + s: "history_polygonlocation_pkey", + }, +} + +type historyPolygonlocationErrors struct { + ErrUniqueHistoryPolygonlocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_pool.bob.go b/dberrors/history_pool.bob.go new file mode 100644 index 00000000..adb6f415 --- /dev/null +++ b/dberrors/history_pool.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 HistoryPoolErrors = &historyPoolErrors{ + ErrUniqueHistoryPoolPkey: &UniqueConstraintError{ + schema: "", + table: "history_pool", + columns: []string{"objectid", "version"}, + s: "history_pool_pkey", + }, +} + +type historyPoolErrors struct { + ErrUniqueHistoryPoolPkey *UniqueConstraintError +} diff --git a/dberrors/history_pooldetail.bob.go b/dberrors/history_pooldetail.bob.go new file mode 100644 index 00000000..5c5b57fc --- /dev/null +++ b/dberrors/history_pooldetail.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 HistoryPooldetailErrors = &historyPooldetailErrors{ + ErrUniqueHistoryPooldetailPkey: &UniqueConstraintError{ + schema: "", + table: "history_pooldetail", + columns: []string{"objectid", "version"}, + s: "history_pooldetail_pkey", + }, +} + +type historyPooldetailErrors struct { + ErrUniqueHistoryPooldetailPkey *UniqueConstraintError +} diff --git a/dberrors/history_proposedtreatmentarea.bob.go b/dberrors/history_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..3a1315fe --- /dev/null +++ b/dberrors/history_proposedtreatmentarea.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 HistoryProposedtreatmentareaErrors = &historyProposedtreatmentareaErrors{ + ErrUniqueHistoryProposedtreatmentareaPkey: &UniqueConstraintError{ + schema: "", + table: "history_proposedtreatmentarea", + columns: []string{"objectid", "version"}, + s: "history_proposedtreatmentarea_pkey", + }, +} + +type historyProposedtreatmentareaErrors struct { + ErrUniqueHistoryProposedtreatmentareaPkey *UniqueConstraintError +} diff --git a/dberrors/history_qamosquitoinspection.bob.go b/dberrors/history_qamosquitoinspection.bob.go new file mode 100644 index 00000000..5a52689b --- /dev/null +++ b/dberrors/history_qamosquitoinspection.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 HistoryQamosquitoinspectionErrors = &historyQamosquitoinspectionErrors{ + ErrUniqueHistoryQamosquitoinspectionPkey: &UniqueConstraintError{ + schema: "", + table: "history_qamosquitoinspection", + columns: []string{"objectid", "version"}, + s: "history_qamosquitoinspection_pkey", + }, +} + +type historyQamosquitoinspectionErrors struct { + ErrUniqueHistoryQamosquitoinspectionPkey *UniqueConstraintError +} diff --git a/dberrors/history_rodentlocation.bob.go b/dberrors/history_rodentlocation.bob.go new file mode 100644 index 00000000..c6a0372a --- /dev/null +++ b/dberrors/history_rodentlocation.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 HistoryRodentlocationErrors = &historyRodentlocationErrors{ + ErrUniqueHistoryRodentlocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_rodentlocation", + columns: []string{"objectid", "version"}, + s: "history_rodentlocation_pkey", + }, +} + +type historyRodentlocationErrors struct { + ErrUniqueHistoryRodentlocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_samplecollection.bob.go b/dberrors/history_samplecollection.bob.go new file mode 100644 index 00000000..11dfff94 --- /dev/null +++ b/dberrors/history_samplecollection.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 HistorySamplecollectionErrors = &historySamplecollectionErrors{ + ErrUniqueHistorySamplecollectionPkey: &UniqueConstraintError{ + schema: "", + table: "history_samplecollection", + columns: []string{"objectid", "version"}, + s: "history_samplecollection_pkey", + }, +} + +type historySamplecollectionErrors struct { + ErrUniqueHistorySamplecollectionPkey *UniqueConstraintError +} diff --git a/dberrors/history_samplelocation.bob.go b/dberrors/history_samplelocation.bob.go new file mode 100644 index 00000000..e7013de7 --- /dev/null +++ b/dberrors/history_samplelocation.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 HistorySamplelocationErrors = &historySamplelocationErrors{ + ErrUniqueHistorySamplelocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_samplelocation", + columns: []string{"objectid", "version"}, + s: "history_samplelocation_pkey", + }, +} + +type historySamplelocationErrors struct { + ErrUniqueHistorySamplelocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_servicerequest.bob.go b/dberrors/history_servicerequest.bob.go new file mode 100644 index 00000000..49ae7a00 --- /dev/null +++ b/dberrors/history_servicerequest.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 HistoryServicerequestErrors = &historyServicerequestErrors{ + ErrUniqueHistoryServicerequestPkey: &UniqueConstraintError{ + schema: "", + table: "history_servicerequest", + columns: []string{"objectid", "version"}, + s: "history_servicerequest_pkey", + }, +} + +type historyServicerequestErrors struct { + ErrUniqueHistoryServicerequestPkey *UniqueConstraintError +} diff --git a/dberrors/history_speciesabundance.bob.go b/dberrors/history_speciesabundance.bob.go new file mode 100644 index 00000000..4ea93258 --- /dev/null +++ b/dberrors/history_speciesabundance.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 HistorySpeciesabundanceErrors = &historySpeciesabundanceErrors{ + ErrUniqueHistorySpeciesabundancePkey: &UniqueConstraintError{ + schema: "", + table: "history_speciesabundance", + columns: []string{"objectid", "version"}, + s: "history_speciesabundance_pkey", + }, +} + +type historySpeciesabundanceErrors struct { + ErrUniqueHistorySpeciesabundancePkey *UniqueConstraintError +} diff --git a/dberrors/history_stormdrain.bob.go b/dberrors/history_stormdrain.bob.go new file mode 100644 index 00000000..d26b9c3b --- /dev/null +++ b/dberrors/history_stormdrain.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 HistoryStormdrainErrors = &historyStormdrainErrors{ + ErrUniqueHistoryStormdrainPkey: &UniqueConstraintError{ + schema: "", + table: "history_stormdrain", + columns: []string{"objectid", "version"}, + s: "history_stormdrain_pkey", + }, +} + +type historyStormdrainErrors struct { + ErrUniqueHistoryStormdrainPkey *UniqueConstraintError +} diff --git a/dberrors/history_timecard.bob.go b/dberrors/history_timecard.bob.go new file mode 100644 index 00000000..54f5abf9 --- /dev/null +++ b/dberrors/history_timecard.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 HistoryTimecardErrors = &historyTimecardErrors{ + ErrUniqueHistoryTimecardPkey: &UniqueConstraintError{ + schema: "", + table: "history_timecard", + columns: []string{"objectid", "version"}, + s: "history_timecard_pkey", + }, +} + +type historyTimecardErrors struct { + ErrUniqueHistoryTimecardPkey *UniqueConstraintError +} diff --git a/dberrors/history_trapdata.bob.go b/dberrors/history_trapdata.bob.go new file mode 100644 index 00000000..71786691 --- /dev/null +++ b/dberrors/history_trapdata.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 HistoryTrapdatumErrors = &historyTrapdatumErrors{ + ErrUniqueHistoryTrapdataPkey: &UniqueConstraintError{ + schema: "", + table: "history_trapdata", + columns: []string{"objectid", "version"}, + s: "history_trapdata_pkey", + }, +} + +type historyTrapdatumErrors struct { + ErrUniqueHistoryTrapdataPkey *UniqueConstraintError +} diff --git a/dberrors/history_traplocation.bob.go b/dberrors/history_traplocation.bob.go new file mode 100644 index 00000000..f427076f --- /dev/null +++ b/dberrors/history_traplocation.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 HistoryTraplocationErrors = &historyTraplocationErrors{ + ErrUniqueHistoryTraplocationPkey: &UniqueConstraintError{ + schema: "", + table: "history_traplocation", + columns: []string{"objectid", "version"}, + s: "history_traplocation_pkey", + }, +} + +type historyTraplocationErrors struct { + ErrUniqueHistoryTraplocationPkey *UniqueConstraintError +} diff --git a/dberrors/history_treatment.bob.go b/dberrors/history_treatment.bob.go new file mode 100644 index 00000000..6492cd44 --- /dev/null +++ b/dberrors/history_treatment.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 HistoryTreatmentErrors = &historyTreatmentErrors{ + ErrUniqueHistoryTreatmentPkey: &UniqueConstraintError{ + schema: "", + table: "history_treatment", + columns: []string{"objectid", "version"}, + s: "history_treatment_pkey", + }, +} + +type historyTreatmentErrors struct { + ErrUniqueHistoryTreatmentPkey *UniqueConstraintError +} diff --git a/dberrors/history_treatmentarea.bob.go b/dberrors/history_treatmentarea.bob.go new file mode 100644 index 00000000..23422352 --- /dev/null +++ b/dberrors/history_treatmentarea.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 HistoryTreatmentareaErrors = &historyTreatmentareaErrors{ + ErrUniqueHistoryTreatmentareaPkey: &UniqueConstraintError{ + schema: "", + table: "history_treatmentarea", + columns: []string{"objectid", "version"}, + s: "history_treatmentarea_pkey", + }, +} + +type historyTreatmentareaErrors struct { + ErrUniqueHistoryTreatmentareaPkey *UniqueConstraintError +} diff --git a/dberrors/history_zones.bob.go b/dberrors/history_zones.bob.go new file mode 100644 index 00000000..af05f79f --- /dev/null +++ b/dberrors/history_zones.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 HistoryZoneErrors = &historyZoneErrors{ + ErrUniqueHistoryZonesPkey: &UniqueConstraintError{ + schema: "", + table: "history_zones", + columns: []string{"objectid", "version"}, + s: "history_zones_pkey", + }, +} + +type historyZoneErrors struct { + ErrUniqueHistoryZonesPkey *UniqueConstraintError +} diff --git a/dberrors/history_zones2.bob.go b/dberrors/history_zones2.bob.go new file mode 100644 index 00000000..824370d7 --- /dev/null +++ b/dberrors/history_zones2.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 HistoryZones2Errors = &historyZones2Errors{ + ErrUniqueHistoryZones2Pkey: &UniqueConstraintError{ + schema: "", + table: "history_zones2", + columns: []string{"objectid", "version"}, + s: "history_zones2_pkey", + }, +} + +type historyZones2Errors struct { + ErrUniqueHistoryZones2Pkey *UniqueConstraintError +} diff --git a/dbinfo/fs_containerrelate.bob.go b/dbinfo/fs_containerrelate.bob.go new file mode 100644 index 00000000..aef6bb7d --- /dev/null +++ b/dbinfo/fs_containerrelate.bob.go @@ -0,0 +1,277 @@ +// 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 FSContainerrelates = Table[ + fsContainerrelateColumns, + fsContainerrelateIndexes, + fsContainerrelateForeignKeys, + fsContainerrelateUniques, + fsContainerrelateChecks, +]{ + Schema: "", + Name: "fs_containerrelate", + Columns: fsContainerrelateColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containertype: column{ + Name: "containertype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Inspsampleid: column{ + Name: "inspsampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Mosquitoinspid: column{ + Name: "mosquitoinspid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Treatmentid: column{ + Name: "treatmentid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsContainerrelateIndexes{ + FSContainerrelatePkey: index{ + Type: "btree", + Name: "fs_containerrelate_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_containerrelate_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsContainerrelateForeignKeys{ + FSContainerrelateFSContainerrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_containerrelate.fs_containerrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsContainerrelateColumns struct { + OrganizationID column + Containertype column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Inspsampleid column + Mosquitoinspid column + Objectid column + Treatmentid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsContainerrelateColumns) 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.Updated, + } +} + +type fsContainerrelateIndexes struct { + FSContainerrelatePkey index +} + +func (i fsContainerrelateIndexes) AsSlice() []index { + return []index{ + i.FSContainerrelatePkey, + } +} + +type fsContainerrelateForeignKeys struct { + FSContainerrelateFSContainerrelateOrganizationIDFkey foreignKey +} + +func (f fsContainerrelateForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSContainerrelateFSContainerrelateOrganizationIDFkey, + } +} + +type fsContainerrelateUniques struct{} + +func (u fsContainerrelateUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsContainerrelateChecks struct{} + +func (c fsContainerrelateChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_fieldscoutinglog.bob.go b/dbinfo/fs_fieldscoutinglog.bob.go new file mode 100644 index 00000000..1be9900e --- /dev/null +++ b/dbinfo/fs_fieldscoutinglog.bob.go @@ -0,0 +1,247 @@ +// 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 FSFieldscoutinglogs = Table[ + fsFieldscoutinglogColumns, + fsFieldscoutinglogIndexes, + fsFieldscoutinglogForeignKeys, + fsFieldscoutinglogUniques, + fsFieldscoutinglogChecks, +]{ + Schema: "", + Name: "fs_fieldscoutinglog", + Columns: fsFieldscoutinglogColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Status: column{ + Name: "status", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsFieldscoutinglogIndexes{ + FSFieldscoutinglogPkey: index{ + Type: "btree", + Name: "fs_fieldscoutinglog_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_fieldscoutinglog_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsFieldscoutinglogForeignKeys{ + FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsFieldscoutinglogColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Objectid column + Status column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsFieldscoutinglogColumns) 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.Updated, + } +} + +type fsFieldscoutinglogIndexes struct { + FSFieldscoutinglogPkey index +} + +func (i fsFieldscoutinglogIndexes) AsSlice() []index { + return []index{ + i.FSFieldscoutinglogPkey, + } +} + +type fsFieldscoutinglogForeignKeys struct { + FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey foreignKey +} + +func (f fsFieldscoutinglogForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey, + } +} + +type fsFieldscoutinglogUniques struct{} + +func (u fsFieldscoutinglogUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsFieldscoutinglogChecks struct{} + +func (c fsFieldscoutinglogChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_habitatrelate.bob.go b/dbinfo/fs_habitatrelate.bob.go new file mode 100644 index 00000000..64de901c --- /dev/null +++ b/dbinfo/fs_habitatrelate.bob.go @@ -0,0 +1,257 @@ +// 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 FSHabitatrelates = Table[ + fsHabitatrelateColumns, + fsHabitatrelateIndexes, + fsHabitatrelateForeignKeys, + fsHabitatrelateUniques, + fsHabitatrelateChecks, +]{ + Schema: "", + Name: "fs_habitatrelate", + Columns: fsHabitatrelateColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ForeignID: column{ + Name: "foreign_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitattype: column{ + Name: "habitattype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsHabitatrelateIndexes{ + FSHabitatrelatePkey: index{ + Type: "btree", + Name: "fs_habitatrelate_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_habitatrelate_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsHabitatrelateForeignKeys{ + FSHabitatrelateFSHabitatrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_habitatrelate.fs_habitatrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsHabitatrelateColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + ForeignID column + Globalid column + Habitattype column + Objectid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsHabitatrelateColumns) 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.Updated, + } +} + +type fsHabitatrelateIndexes struct { + FSHabitatrelatePkey index +} + +func (i fsHabitatrelateIndexes) AsSlice() []index { + return []index{ + i.FSHabitatrelatePkey, + } +} + +type fsHabitatrelateForeignKeys struct { + FSHabitatrelateFSHabitatrelateOrganizationIDFkey foreignKey +} + +func (f fsHabitatrelateForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSHabitatrelateFSHabitatrelateOrganizationIDFkey, + } +} + +type fsHabitatrelateUniques struct{} + +func (u fsHabitatrelateUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsHabitatrelateChecks struct{} + +func (c fsHabitatrelateChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_inspectionsample.bob.go b/dbinfo/fs_inspectionsample.bob.go new file mode 100644 index 00000000..c3dec84e --- /dev/null +++ b/dbinfo/fs_inspectionsample.bob.go @@ -0,0 +1,277 @@ +// 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 FSInspectionsamples = Table[ + fsInspectionsampleColumns, + fsInspectionsampleIndexes, + fsInspectionsampleForeignKeys, + fsInspectionsampleUniques, + fsInspectionsampleChecks, +]{ + Schema: "", + Name: "fs_inspectionsample", + Columns: fsInspectionsampleColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Idbytech: column{ + Name: "idbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspID: column{ + Name: "insp_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsInspectionsampleIndexes{ + FSInspectionsamplePkey: index{ + Type: "btree", + Name: "fs_inspectionsample_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_inspectionsample_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsInspectionsampleForeignKeys{ + FSInspectionsampleFSInspectionsampleOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_inspectionsample.fs_inspectionsample_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsInspectionsampleColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Idbytech column + InspID column + Objectid column + Processed column + Sampleid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsInspectionsampleColumns) 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.Updated, + } +} + +type fsInspectionsampleIndexes struct { + FSInspectionsamplePkey index +} + +func (i fsInspectionsampleIndexes) AsSlice() []index { + return []index{ + i.FSInspectionsamplePkey, + } +} + +type fsInspectionsampleForeignKeys struct { + FSInspectionsampleFSInspectionsampleOrganizationIDFkey foreignKey +} + +func (f fsInspectionsampleForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSInspectionsampleFSInspectionsampleOrganizationIDFkey, + } +} + +type fsInspectionsampleUniques struct{} + +func (u fsInspectionsampleUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsInspectionsampleChecks struct{} + +func (c fsInspectionsampleChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_inspectionsampledetail.bob.go b/dbinfo/fs_inspectionsampledetail.bob.go new file mode 100644 index 00000000..aae3be2d --- /dev/null +++ b/dbinfo/fs_inspectionsampledetail.bob.go @@ -0,0 +1,387 @@ +// 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 FSInspectionsampledetails = Table[ + fsInspectionsampledetailColumns, + fsInspectionsampledetailIndexes, + fsInspectionsampledetailForeignKeys, + fsInspectionsampledetailUniques, + fsInspectionsampledetailChecks, +]{ + Schema: "", + Name: "fs_inspectionsampledetail", + Columns: fsInspectionsampledetailColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fadultact: column{ + Name: "fadultact", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fdomstage: column{ + Name: "fdomstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Feggcount: column{ + Name: "feggcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldspecies: column{ + Name: "fieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flarvcount: column{ + Name: "flarvcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flstages: column{ + Name: "flstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fpupcount: column{ + Name: "fpupcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspsampleID: column{ + Name: "inspsample_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Labspecies: column{ + Name: "labspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ldomstage: column{ + Name: "ldomstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Leggcount: column{ + Name: "leggcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Llarvcount: column{ + Name: "llarvcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lpupcount: column{ + Name: "lpupcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsInspectionsampledetailIndexes{ + FSInspectionsampledetailPkey: index{ + Type: "btree", + Name: "fs_inspectionsampledetail_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_inspectionsampledetail_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsInspectionsampledetailForeignKeys{ + FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsInspectionsampledetailColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Editdate column + Editor column + Fadultact column + Fdomstage column + Feggcount column + Fieldspecies column + Flarvcount column + Flstages column + Fpupcount column + Globalid column + InspsampleID column + Labspecies column + Ldomstage column + Leggcount column + Llarvcount column + Lpupcount column + Objectid column + Processed column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsInspectionsampledetailColumns) 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.Updated, + } +} + +type fsInspectionsampledetailIndexes struct { + FSInspectionsampledetailPkey index +} + +func (i fsInspectionsampledetailIndexes) AsSlice() []index { + return []index{ + i.FSInspectionsampledetailPkey, + } +} + +type fsInspectionsampledetailForeignKeys struct { + FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey foreignKey +} + +func (f fsInspectionsampledetailForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey, + } +} + +type fsInspectionsampledetailUniques struct{} + +func (u fsInspectionsampledetailUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsInspectionsampledetailChecks struct{} + +func (c fsInspectionsampledetailChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_linelocation.bob.go b/dbinfo/fs_linelocation.bob.go new file mode 100644 index 00000000..aaee1e0b --- /dev/null +++ b/dbinfo/fs_linelocation.bob.go @@ -0,0 +1,617 @@ +// 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 FSLinelocations = Table[ + fsLinelocationColumns, + fsLinelocationIndexes, + fsLinelocationForeignKeys, + fsLinelocationUniques, + fsLinelocationChecks, +]{ + Schema: "", + Name: "fs_linelocation", + Columns: fsLinelocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LengthFT: column{ + Name: "length_ft", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LengthMeters: column{ + Name: "length_meters", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + WidthFT: column{ + Name: "width_ft", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + WidthMeters: column{ + Name: "width_meters", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsLinelocationIndexes{ + FSLinelocationPkey: index{ + Type: "btree", + Name: "fs_linelocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_linelocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsLinelocationForeignKeys{ + FSLinelocationFSLinelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_linelocation.fs_linelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsLinelocationColumns struct { + OrganizationID column + Accessdesc column + Acres column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Hectares column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + LengthFT column + LengthMeters column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + ShapeLength column + Usetype column + Waterorigin column + WidthFT column + WidthMeters column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsLinelocationColumns) 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.Updated, + } +} + +type fsLinelocationIndexes struct { + FSLinelocationPkey index +} + +func (i fsLinelocationIndexes) AsSlice() []index { + return []index{ + i.FSLinelocationPkey, + } +} + +type fsLinelocationForeignKeys struct { + FSLinelocationFSLinelocationOrganizationIDFkey foreignKey +} + +func (f fsLinelocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSLinelocationFSLinelocationOrganizationIDFkey, + } +} + +type fsLinelocationUniques struct{} + +func (u fsLinelocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsLinelocationChecks struct{} + +func (c fsLinelocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_locationtracking.bob.go b/dbinfo/fs_locationtracking.bob.go new file mode 100644 index 00000000..08be0eb3 --- /dev/null +++ b/dbinfo/fs_locationtracking.bob.go @@ -0,0 +1,257 @@ +// 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 FSLocationtrackings = Table[ + fsLocationtrackingColumns, + fsLocationtrackingIndexes, + fsLocationtrackingForeignKeys, + fsLocationtrackingUniques, + fsLocationtrackingChecks, +]{ + Schema: "", + Name: "fs_locationtracking", + Columns: fsLocationtrackingColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accuracy: column{ + Name: "accuracy", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsLocationtrackingIndexes{ + FSLocationtrackingPkey: index{ + Type: "btree", + Name: "fs_locationtracking_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_locationtracking_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsLocationtrackingForeignKeys{ + FSLocationtrackingFSLocationtrackingOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_locationtracking.fs_locationtracking_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsLocationtrackingColumns struct { + OrganizationID column + Accuracy column + Creationdate column + Creator column + Editdate column + Editor column + Fieldtech column + Globalid column + Objectid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsLocationtrackingColumns) 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.Updated, + } +} + +type fsLocationtrackingIndexes struct { + FSLocationtrackingPkey index +} + +func (i fsLocationtrackingIndexes) AsSlice() []index { + return []index{ + i.FSLocationtrackingPkey, + } +} + +type fsLocationtrackingForeignKeys struct { + FSLocationtrackingFSLocationtrackingOrganizationIDFkey foreignKey +} + +func (f fsLocationtrackingForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSLocationtrackingFSLocationtrackingOrganizationIDFkey, + } +} + +type fsLocationtrackingUniques struct{} + +func (u fsLocationtrackingUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsLocationtrackingChecks struct{} + +func (c fsLocationtrackingChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_mosquitoinspection.bob.go b/dbinfo/fs_mosquitoinspection.bob.go new file mode 100644 index 00000000..89489a0f --- /dev/null +++ b/dbinfo/fs_mosquitoinspection.bob.go @@ -0,0 +1,707 @@ +// 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 FSMosquitoinspections = Table[ + fsMosquitoinspectionColumns, + fsMosquitoinspectionIndexes, + fsMosquitoinspectionForeignKeys, + fsMosquitoinspectionUniques, + fsMosquitoinspectionChecks, +]{ + Schema: "", + Name: "fs_mosquitoinspection", + Columns: fsMosquitoinspectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Actiontaken: column{ + Name: "actiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adultact: column{ + Name: "adultact", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avglarvae: column{ + Name: "avglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avgpupae: column{ + Name: "avgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Breeding: column{ + Name: "breeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Cbcount: column{ + Name: "cbcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containercount: column{ + Name: "containercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Domstage: column{ + Name: "domstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Eggs: column{ + Name: "eggs", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldspecies: column{ + Name: "fieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaepresent: column{ + Name: "larvaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lstages: column{ + Name: "lstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Numdips: column{ + Name: "numdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Personalcontact: column{ + Name: "personalcontact", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Posdips: column{ + Name: "posdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Positivecontainercount: column{ + Name: "positivecontainercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pupaepresent: column{ + Name: "pupaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sdid: column{ + Name: "sdid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Tirecount: column{ + Name: "tirecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totlarvae: column{ + Name: "totlarvae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totpupae: column{ + Name: "totpupae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Visualmonitoring: column{ + Name: "visualmonitoring", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vmcomments: column{ + Name: "vmcomments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adminaction: column{ + Name: "adminaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ptaid: column{ + Name: "ptaid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsMosquitoinspectionIndexes{ + FSMosquitoinspectionPkey: index{ + Type: "btree", + Name: "fs_mosquitoinspection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_mosquitoinspection_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsMosquitoinspectionForeignKeys{ + FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsMosquitoinspectionColumns struct { + OrganizationID column + Actiontaken column + Activity column + Adultact column + Avetemp column + Avglarvae column + Avgpupae column + Breeding column + Cbcount column + Comments column + Containercount column + Creationdate column + Creator column + Domstage column + Eggs column + Enddatetime column + Editdate column + Editor column + Fieldspecies column + Fieldtech column + Globalid column + Jurisdiction column + Larvaepresent column + Linelocid column + Locationname column + Lstages column + Numdips column + Objectid column + Personalcontact column + Pointlocid column + Polygonlocid column + Posdips column + Positivecontainercount column + Pupaepresent column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sdid column + Sitecond column + Srid column + Startdatetime column + Tirecount column + Totlarvae column + Totpupae column + Visualmonitoring column + Vmcomments column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Adminaction column + Ptaid column + Updated column +} + +func (c fsMosquitoinspectionColumns) 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.Updated, + } +} + +type fsMosquitoinspectionIndexes struct { + FSMosquitoinspectionPkey index +} + +func (i fsMosquitoinspectionIndexes) AsSlice() []index { + return []index{ + i.FSMosquitoinspectionPkey, + } +} + +type fsMosquitoinspectionForeignKeys struct { + FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey foreignKey +} + +func (f fsMosquitoinspectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey, + } +} + +type fsMosquitoinspectionUniques struct{} + +func (u fsMosquitoinspectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsMosquitoinspectionChecks struct{} + +func (c fsMosquitoinspectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_pointlocation.bob.go b/dbinfo/fs_pointlocation.bob.go new file mode 100644 index 00000000..77794756 --- /dev/null +++ b/dbinfo/fs_pointlocation.bob.go @@ -0,0 +1,577 @@ +// 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 FSPointlocations = Table[ + fsPointlocationColumns, + fsPointlocationIndexes, + fsPointlocationForeignKeys, + fsPointlocationUniques, + fsPointlocationChecks, +]{ + Schema: "", + Name: "fs_pointlocation", + Columns: fsPointlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Stype: column{ + Name: "stype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + X: column{ + Name: "x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Y: column{ + Name: "y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Assignedtech: column{ + Name: "assignedtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + DeactivateReason: column{ + Name: "deactivate_reason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scalarpriority: column{ + Name: "scalarpriority", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sourcestatus: column{ + Name: "sourcestatus", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsPointlocationIndexes{ + FSPointlocationPkey: index{ + Type: "btree", + Name: "fs_pointlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_pointlocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsPointlocationForeignKeys{ + FSPointlocationFSPointlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_pointlocation.fs_pointlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsPointlocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Stype column + Symbology column + Usetype column + Waterorigin column + X column + Y column + Zone column + Zone2 column + GeometryX column + GeometryY column + Assignedtech column + DeactivateReason column + Scalarpriority column + Sourcestatus column + Updated column +} + +func (c fsPointlocationColumns) 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.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.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Stype, c.Symbology, c.Usetype, c.Waterorigin, c.X, c.Y, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Assignedtech, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Updated, + } +} + +type fsPointlocationIndexes struct { + FSPointlocationPkey index +} + +func (i fsPointlocationIndexes) AsSlice() []index { + return []index{ + i.FSPointlocationPkey, + } +} + +type fsPointlocationForeignKeys struct { + FSPointlocationFSPointlocationOrganizationIDFkey foreignKey +} + +func (f fsPointlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSPointlocationFSPointlocationOrganizationIDFkey, + } +} + +type fsPointlocationUniques struct{} + +func (u fsPointlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsPointlocationChecks struct{} + +func (c fsPointlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_polygonlocation.bob.go b/dbinfo/fs_polygonlocation.bob.go new file mode 100644 index 00000000..9ff7c229 --- /dev/null +++ b/dbinfo/fs_polygonlocation.bob.go @@ -0,0 +1,557 @@ +// 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 FSPolygonlocations = Table[ + fsPolygonlocationColumns, + fsPolygonlocationIndexes, + fsPolygonlocationForeignKeys, + fsPolygonlocationUniques, + fsPolygonlocationChecks, +]{ + Schema: "", + Name: "fs_polygonlocation", + Columns: fsPolygonlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Filter: column{ + Name: "filter", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsPolygonlocationIndexes{ + FSPolygonlocationPkey: index{ + Type: "btree", + Name: "fs_polygonlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_polygonlocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsPolygonlocationForeignKeys{ + FSPolygonlocationFSPolygonlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_polygonlocation.fs_polygonlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsPolygonlocationColumns struct { + OrganizationID column + Accessdesc column + Acres column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Filter column + Globalid column + Habitat column + Hectares column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + ShapeArea column + ShapeLength column + Usetype column + Waterorigin column + Zone column + Zone2 column + GeometryX column + GeometryY column + Updated column +} + +func (c fsPolygonlocationColumns) 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.Filter, 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.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeArea, c.ShapeLength, c.Usetype, c.Waterorigin, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Updated, + } +} + +type fsPolygonlocationIndexes struct { + FSPolygonlocationPkey index +} + +func (i fsPolygonlocationIndexes) AsSlice() []index { + return []index{ + i.FSPolygonlocationPkey, + } +} + +type fsPolygonlocationForeignKeys struct { + FSPolygonlocationFSPolygonlocationOrganizationIDFkey foreignKey +} + +func (f fsPolygonlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSPolygonlocationFSPolygonlocationOrganizationIDFkey, + } +} + +type fsPolygonlocationUniques struct{} + +func (u fsPolygonlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsPolygonlocationChecks struct{} + +func (c fsPolygonlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_pool.bob.go b/dbinfo/fs_pool.bob.go new file mode 100644 index 00000000..c6dd827f --- /dev/null +++ b/dbinfo/fs_pool.bob.go @@ -0,0 +1,417 @@ +// 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 FSPools = Table[ + fsPoolColumns, + fsPoolIndexes, + fsPoolForeignKeys, + fsPoolUniques, + fsPoolChecks, +]{ + Schema: "", + Name: "fs_pool", + Columns: fsPoolColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datesent: column{ + Name: "datesent", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetested: column{ + Name: "datetested", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasepos: column{ + Name: "diseasepos", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasetested: column{ + Name: "diseasetested", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lab: column{ + Name: "lab", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LabID: column{ + Name: "lab_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Poolyear: column{ + Name: "poolyear", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Survtech: column{ + Name: "survtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testmethod: column{ + Name: "testmethod", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testtech: column{ + Name: "testtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvcollectionid: column{ + Name: "vectorsurvcollectionid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvpoolid: column{ + Name: "vectorsurvpoolid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtrapdataid: column{ + Name: "vectorsurvtrapdataid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsPoolIndexes{ + FSPoolPkey: index{ + Type: "btree", + Name: "fs_pool_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_pool_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsPoolForeignKeys{ + FSPoolFSPoolOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_pool.fs_pool_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsPoolColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Datesent column + Datetested column + Diseasepos column + Diseasetested column + Editdate column + Editor column + Gatewaysync column + Globalid column + Lab column + LabID column + Objectid column + Poolyear column + Processed column + Sampleid column + Survtech column + Testmethod column + Testtech column + TrapdataID column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Vectorsurvcollectionid column + Vectorsurvpoolid column + Vectorsurvtrapdataid column + Updated column +} + +func (c fsPoolColumns) 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.Updated, + } +} + +type fsPoolIndexes struct { + FSPoolPkey index +} + +func (i fsPoolIndexes) AsSlice() []index { + return []index{ + i.FSPoolPkey, + } +} + +type fsPoolForeignKeys struct { + FSPoolFSPoolOrganizationIDFkey foreignKey +} + +func (f fsPoolForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSPoolFSPoolOrganizationIDFkey, + } +} + +type fsPoolUniques struct{} + +func (u fsPoolUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsPoolChecks struct{} + +func (c fsPoolChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_pooldetail.bob.go b/dbinfo/fs_pooldetail.bob.go new file mode 100644 index 00000000..794474bf --- /dev/null +++ b/dbinfo/fs_pooldetail.bob.go @@ -0,0 +1,277 @@ +// 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 FSPooldetails = Table[ + fsPooldetailColumns, + fsPooldetailIndexes, + fsPooldetailForeignKeys, + fsPooldetailUniques, + fsPooldetailChecks, +]{ + Schema: "", + Name: "fs_pooldetail", + Columns: fsPooldetailColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Females: column{ + Name: "females", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + PoolID: column{ + Name: "pool_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsPooldetailIndexes{ + FSPooldetailPkey: index{ + Type: "btree", + Name: "fs_pooldetail_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_pooldetail_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsPooldetailForeignKeys{ + FSPooldetailFSPooldetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_pooldetail.fs_pooldetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsPooldetailColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Females column + Globalid column + Objectid column + PoolID column + Species column + TrapdataID column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsPooldetailColumns) 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.Updated, + } +} + +type fsPooldetailIndexes struct { + FSPooldetailPkey index +} + +func (i fsPooldetailIndexes) AsSlice() []index { + return []index{ + i.FSPooldetailPkey, + } +} + +type fsPooldetailForeignKeys struct { + FSPooldetailFSPooldetailOrganizationIDFkey foreignKey +} + +func (f fsPooldetailForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSPooldetailFSPooldetailOrganizationIDFkey, + } +} + +type fsPooldetailUniques struct{} + +func (u fsPooldetailUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsPooldetailChecks struct{} + +func (c fsPooldetailChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_proposedtreatmentarea.bob.go b/dbinfo/fs_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..3d79a3d4 --- /dev/null +++ b/dbinfo/fs_proposedtreatmentarea.bob.go @@ -0,0 +1,467 @@ +// 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 FSProposedtreatmentareas = Table[ + fsProposedtreatmentareaColumns, + fsProposedtreatmentareaIndexes, + fsProposedtreatmentareaForeignKeys, + fsProposedtreatmentareaUniques, + fsProposedtreatmentareaChecks, +]{ + Schema: "", + Name: "fs_proposedtreatmentarea", + Columns: fsProposedtreatmentareaColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completed: column{ + Name: "completed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completedby: column{ + Name: "completedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completeddate: column{ + Name: "completeddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Duedate: column{ + Name: "duedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Exported: column{ + Name: "exported", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Issprayroute: column{ + Name: "issprayroute", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Method: column{ + Name: "method", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetapprate: column{ + Name: "targetapprate", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetproduct: column{ + Name: "targetproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetspecies: column{ + Name: "targetspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsProposedtreatmentareaIndexes{ + FSProposedtreatmentareaPkey: index{ + Type: "btree", + Name: "fs_proposedtreatmentarea_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_proposedtreatmentarea_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsProposedtreatmentareaForeignKeys{ + FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsProposedtreatmentareaColumns struct { + OrganizationID column + Acres column + Comments column + Completed column + Completedby column + Completeddate column + Creationdate column + Creator column + Duedate column + Exported column + Editdate column + Editor column + Globalid column + Hectares column + Issprayroute column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Method column + Name column + Objectid column + Priority column + Reviewed column + Reviewedby column + Revieweddate column + ShapeArea column + ShapeLength column + Targetapprate column + Targetproduct column + Targetspecies column + Zone column + Zone2 column + GeometryX column + GeometryY column + Updated column +} + +func (c fsProposedtreatmentareaColumns) AsSlice() []column { + return []column{ + c.OrganizationID, c.Acres, c.Comments, c.Completed, c.Completedby, c.Completeddate, c.Creationdate, c.Creator, c.Duedate, c.Exported, c.Editdate, c.Editor, c.Globalid, c.Hectares, c.Issprayroute, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Method, c.Name, c.Objectid, c.Priority, c.Reviewed, c.Reviewedby, c.Revieweddate, c.ShapeArea, c.ShapeLength, c.Targetapprate, c.Targetproduct, c.Targetspecies, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Updated, + } +} + +type fsProposedtreatmentareaIndexes struct { + FSProposedtreatmentareaPkey index +} + +func (i fsProposedtreatmentareaIndexes) AsSlice() []index { + return []index{ + i.FSProposedtreatmentareaPkey, + } +} + +type fsProposedtreatmentareaForeignKeys struct { + FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey foreignKey +} + +func (f fsProposedtreatmentareaForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey, + } +} + +type fsProposedtreatmentareaUniques struct{} + +func (u fsProposedtreatmentareaUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsProposedtreatmentareaChecks struct{} + +func (c fsProposedtreatmentareaChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_qamosquitoinspection.bob.go b/dbinfo/fs_qamosquitoinspection.bob.go new file mode 100644 index 00000000..eb43a8fc --- /dev/null +++ b/dbinfo/fs_qamosquitoinspection.bob.go @@ -0,0 +1,757 @@ +// 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 FSQamosquitoinspections = Table[ + fsQamosquitoinspectionColumns, + fsQamosquitoinspectionIndexes, + fsQamosquitoinspectionForeignKeys, + fsQamosquitoinspectionUniques, + fsQamosquitoinspectionChecks, +]{ + Schema: "", + Name: "fs_qamosquitoinspection", + Columns: fsQamosquitoinspectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acresbreeding: column{ + Name: "acresbreeding", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Actiontaken: column{ + Name: "actiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adultactivity: column{ + Name: "adultactivity", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Aquaticorganisms: column{ + Name: "aquaticorganisms", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Breedingpotential: column{ + Name: "breedingpotential", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fish: column{ + Name: "fish", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue1: column{ + Name: "habvalue1", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue1percent: column{ + Name: "habvalue1percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue2: column{ + Name: "habvalue2", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue2percent: column{ + Name: "habvalue2percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaeinsidetreatedarea: column{ + Name: "larvaeinsidetreatedarea", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaeoutsidetreatedarea: column{ + Name: "larvaeoutsidetreatedarea", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaepresent: column{ + Name: "larvaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaereason: column{ + Name: "larvaereason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LR: column{ + Name: "lr", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Mosquitohabitat: column{ + Name: "mosquitohabitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Movingwater: column{ + Name: "movingwater", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Negdips: column{ + Name: "negdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nowaterever: column{ + Name: "nowaterever", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Posdips: column{ + Name: "posdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Potential: column{ + Name: "potential", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitetype: column{ + Name: "sitetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Soilconditions: column{ + Name: "soilconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sourcereduction: column{ + Name: "sourcereduction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totalacres: column{ + Name: "totalacres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vegetation: column{ + Name: "vegetation", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterconditions: column{ + Name: "waterconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterduration: column{ + Name: "waterduration", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement1: column{ + Name: "watermovement1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement1percent: column{ + Name: "watermovement1percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement2: column{ + Name: "watermovement2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement2percent: column{ + Name: "watermovement2percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterpresent: column{ + Name: "waterpresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watersource: column{ + Name: "watersource", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsQamosquitoinspectionIndexes{ + FSQamosquitoinspectionPkey: index{ + Type: "btree", + Name: "fs_qamosquitoinspection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_qamosquitoinspection_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsQamosquitoinspectionForeignKeys{ + FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsQamosquitoinspectionColumns struct { + OrganizationID column + Acresbreeding column + Actiontaken column + Adultactivity column + Aquaticorganisms column + Avetemp column + Breedingpotential column + Comments column + Creationdate column + Creator column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Fish column + Globalid column + Habvalue1 column + Habvalue1percent column + Habvalue2 column + Habvalue2percent column + Larvaeinsidetreatedarea column + Larvaeoutsidetreatedarea column + Larvaepresent column + Larvaereason column + Linelocid column + Locationname column + LR column + Mosquitohabitat column + Movingwater column + Negdips column + Nowaterever column + Objectid column + Pointlocid column + Polygonlocid column + Posdips column + Potential column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sitetype column + Soilconditions column + Sourcereduction column + Startdatetime column + Totalacres column + Vegetation column + Waterconditions column + Waterduration column + Watermovement1 column + Watermovement1percent column + Watermovement2 column + Watermovement2percent column + Waterpresent column + Watersource column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsQamosquitoinspectionColumns) 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.Updated, + } +} + +type fsQamosquitoinspectionIndexes struct { + FSQamosquitoinspectionPkey index +} + +func (i fsQamosquitoinspectionIndexes) AsSlice() []index { + return []index{ + i.FSQamosquitoinspectionPkey, + } +} + +type fsQamosquitoinspectionForeignKeys struct { + FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey foreignKey +} + +func (f fsQamosquitoinspectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey, + } +} + +type fsQamosquitoinspectionUniques struct{} + +func (u fsQamosquitoinspectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsQamosquitoinspectionChecks struct{} + +func (c fsQamosquitoinspectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_rodentlocation.bob.go b/dbinfo/fs_rodentlocation.bob.go new file mode 100644 index 00000000..d1228210 --- /dev/null +++ b/dbinfo/fs_rodentlocation.bob.go @@ -0,0 +1,437 @@ +// 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 FSRodentlocations = Table[ + fsRodentlocationColumns, + fsRodentlocationIndexes, + fsRodentlocationForeignKeys, + fsRodentlocationUniques, + fsRodentlocationChecks, +]{ + Schema: "", + Name: "fs_rodentlocation", + Columns: fsRodentlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectaction: column{ + Name: "lastinspectaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectrodentevidence: column{ + Name: "lastinspectrodentevidence", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectspecies: column{ + Name: "lastinspectspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsRodentlocationIndexes{ + FSRodentlocationPkey: index{ + Type: "btree", + Name: "fs_rodentlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_rodentlocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsRodentlocationForeignKeys{ + FSRodentlocationFSRodentlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_rodentlocation.fs_rodentlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsRodentlocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Lastinspectaction column + Lastinspectconditions column + Lastinspectdate column + Lastinspectrodentevidence column + Lastinspectspecies column + Locationname column + Locationnumber column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Jurisdiction column + Updated column +} + +func (c fsRodentlocationColumns) 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.Updated, + } +} + +type fsRodentlocationIndexes struct { + FSRodentlocationPkey index +} + +func (i fsRodentlocationIndexes) AsSlice() []index { + return []index{ + i.FSRodentlocationPkey, + } +} + +type fsRodentlocationForeignKeys struct { + FSRodentlocationFSRodentlocationOrganizationIDFkey foreignKey +} + +func (f fsRodentlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSRodentlocationFSRodentlocationOrganizationIDFkey, + } +} + +type fsRodentlocationUniques struct{} + +func (u fsRodentlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsRodentlocationChecks struct{} + +func (c fsRodentlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_samplecollection.bob.go b/dbinfo/fs_samplecollection.bob.go new file mode 100644 index 00000000..2ac0a4f2 --- /dev/null +++ b/dbinfo/fs_samplecollection.bob.go @@ -0,0 +1,597 @@ +// 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 FSSamplecollections = Table[ + fsSamplecollectionColumns, + fsSamplecollectionIndexes, + fsSamplecollectionForeignKeys, + fsSamplecollectionUniques, + fsSamplecollectionChecks, +]{ + Schema: "", + Name: "fs_samplecollection", + Columns: fsSamplecollectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Chickenid: column{ + Name: "chickenid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datesent: column{ + Name: "datesent", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetested: column{ + Name: "datetested", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasepos: column{ + Name: "diseasepos", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasetested: column{ + Name: "diseasetested", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flockid: column{ + Name: "flockid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lab: column{ + Name: "lab", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LocID: column{ + Name: "loc_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplecond: column{ + Name: "samplecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplecount: column{ + Name: "samplecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampletype: column{ + Name: "sampletype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sex: column{ + Name: "sex", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Survtech: column{ + Name: "survtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testmethod: column{ + Name: "testmethod", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testtech: column{ + Name: "testtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsSamplecollectionIndexes{ + FSSamplecollectionPkey: index{ + Type: "btree", + Name: "fs_samplecollection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_samplecollection_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsSamplecollectionForeignKeys{ + FSSamplecollectionFSSamplecollectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_samplecollection.fs_samplecollection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsSamplecollectionColumns struct { + OrganizationID column + Activity column + Avetemp column + Chickenid column + Comments column + Creationdate column + Creator column + Datesent column + Datetested column + Diseasepos column + Diseasetested column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Flockid column + Gatewaysync column + Globalid column + Lab column + Locationname column + LocID column + Objectid column + Processed column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Samplecond column + Samplecount column + Sampleid column + Sampletype column + Sex column + Sitecond column + Species column + Startdatetime column + Survtech column + Testmethod column + Testtech column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsSamplecollectionColumns) 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.Updated, + } +} + +type fsSamplecollectionIndexes struct { + FSSamplecollectionPkey index +} + +func (i fsSamplecollectionIndexes) AsSlice() []index { + return []index{ + i.FSSamplecollectionPkey, + } +} + +type fsSamplecollectionForeignKeys struct { + FSSamplecollectionFSSamplecollectionOrganizationIDFkey foreignKey +} + +func (f fsSamplecollectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSSamplecollectionFSSamplecollectionOrganizationIDFkey, + } +} + +type fsSamplecollectionUniques struct{} + +func (u fsSamplecollectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsSamplecollectionChecks struct{} + +func (c fsSamplecollectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_samplelocation.bob.go b/dbinfo/fs_samplelocation.bob.go new file mode 100644 index 00000000..1e4b73df --- /dev/null +++ b/dbinfo/fs_samplelocation.bob.go @@ -0,0 +1,377 @@ +// 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 FSSamplelocations = Table[ + fsSamplelocationColumns, + fsSamplelocationIndexes, + fsSamplelocationForeignKeys, + fsSamplelocationUniques, + fsSamplelocationChecks, +]{ + Schema: "", + Name: "fs_samplelocation", + Columns: fsSamplelocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsSamplelocationIndexes{ + FSSamplelocationPkey: index{ + Type: "btree", + Name: "fs_samplelocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_samplelocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsSamplelocationForeignKeys{ + FSSamplelocationFSSamplelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_samplelocation.fs_samplelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsSamplelocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Gatewaysync column + Globalid column + Habitat column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsSamplelocationColumns) 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.Updated, + } +} + +type fsSamplelocationIndexes struct { + FSSamplelocationPkey index +} + +func (i fsSamplelocationIndexes) AsSlice() []index { + return []index{ + i.FSSamplelocationPkey, + } +} + +type fsSamplelocationForeignKeys struct { + FSSamplelocationFSSamplelocationOrganizationIDFkey foreignKey +} + +func (f fsSamplelocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSSamplelocationFSSamplelocationOrganizationIDFkey, + } +} + +type fsSamplelocationUniques struct{} + +func (u fsSamplelocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsSamplelocationChecks struct{} + +func (c fsSamplelocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_servicerequest.bob.go b/dbinfo/fs_servicerequest.bob.go new file mode 100644 index 00000000..2f8c3c63 --- /dev/null +++ b/dbinfo/fs_servicerequest.bob.go @@ -0,0 +1,997 @@ +// 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 FSServicerequests = Table[ + fsServicerequestColumns, + fsServicerequestIndexes, + fsServicerequestForeignKeys, + fsServicerequestUniques, + fsServicerequestChecks, +]{ + Schema: "", + Name: "fs_servicerequest", + Columns: fsServicerequestColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accepted: column{ + Name: "accepted", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acceptedby: column{ + Name: "acceptedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accepteddate: column{ + Name: "accepteddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Allowed: column{ + Name: "allowed", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Assignedtech: column{ + Name: "assignedtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clraddr1: column{ + Name: "clraddr1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clraddr2: column{ + Name: "clraddr2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clranon: column{ + Name: "clranon", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcity: column{ + Name: "clrcity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcompany: column{ + Name: "clrcompany", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcontpref: column{ + Name: "clrcontpref", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clremail: column{ + Name: "clremail", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrfname: column{ + Name: "clrfname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrother: column{ + Name: "clrother", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrphone1: column{ + Name: "clrphone1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrphone2: column{ + Name: "clrphone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrstate: column{ + Name: "clrstate", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrzip: column{ + Name: "clrzip", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetimeclosed: column{ + Name: "datetimeclosed", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Duedate: column{ + Name: "duedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Entrytech: column{ + Name: "entrytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Estcompletedate: column{ + Name: "estcompletedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalerror: column{ + Name: "externalerror", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Firstresponsedate: column{ + Name: "firstresponsedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Issuesreported: column{ + Name: "issuesreported", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextaction: column{ + Name: "nextaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notificationtimestamp: column{ + Name: "notificationtimestamp", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notified: column{ + Name: "notified", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notifieddate: column{ + Name: "notifieddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recdatetime: column{ + Name: "recdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejectedby: column{ + Name: "rejectedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejecteddate: column{ + Name: "rejecteddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejectedreason: column{ + Name: "rejectedreason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqaddr1: column{ + Name: "reqaddr1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqaddr2: column{ + Name: "reqaddr2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcity: column{ + Name: "reqcity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcompany: column{ + Name: "reqcompany", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcrossst: column{ + Name: "reqcrossst", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqdescr: column{ + Name: "reqdescr", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqfldnotes: column{ + Name: "reqfldnotes", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqmapgrid: column{ + Name: "reqmapgrid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqnotesforcust: column{ + Name: "reqnotesforcust", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqnotesfortech: column{ + Name: "reqnotesfortech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqpermission: column{ + Name: "reqpermission", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqprogramactions: column{ + Name: "reqprogramactions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqstate: column{ + Name: "reqstate", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqsubdiv: column{ + Name: "reqsubdiv", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqtarget: column{ + Name: "reqtarget", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqzip: column{ + Name: "reqzip", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Responsedaycount: column{ + Name: "responsedaycount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scheduled: column{ + Name: "scheduled", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scheduleddate: column{ + Name: "scheduleddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Source: column{ + Name: "source", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SRNumber: column{ + Name: "sr_number", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Status: column{ + Name: "status", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Supervisor: column{ + Name: "supervisor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Techclosed: column{ + Name: "techclosed", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Validx: column{ + Name: "validx", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Validy: column{ + Name: "validy", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Xvalue: column{ + Name: "xvalue", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Yvalue: column{ + Name: "yvalue", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Dog: column{ + Name: "dog", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Spanish: column{ + Name: "spanish", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ScheduleNotes: column{ + Name: "schedule_notes", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SchedulePeriod: column{ + Name: "schedule_period", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsServicerequestIndexes{ + FSServicerequestPkey: index{ + Type: "btree", + Name: "fs_servicerequest_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_servicerequest_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsServicerequestForeignKeys{ + FSServicerequestFSServicerequestOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_servicerequest.fs_servicerequest_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsServicerequestColumns struct { + OrganizationID column + Accepted column + Acceptedby column + Accepteddate column + Allowed column + Assignedtech column + Clraddr1 column + Clraddr2 column + Clranon column + Clrcity column + Clrcompany column + Clrcontpref column + Clremail column + Clrfname column + Clrother column + Clrphone1 column + Clrphone2 column + Clrstate column + Clrzip column + Comments column + Creationdate column + Creator column + Datetimeclosed column + Duedate column + Entrytech column + Estcompletedate column + Externalerror column + Externalid column + Editdate column + Editor column + Firstresponsedate column + Globalid column + Issuesreported column + Jurisdiction column + Nextaction column + Notificationtimestamp column + Notified column + Notifieddate column + Objectid column + Pointlocid column + Priority column + Recdatetime column + Recordstatus column + Rejectedby column + Rejecteddate column + Rejectedreason column + Reqaddr1 column + Reqaddr2 column + Reqcity column + Reqcompany column + Reqcrossst column + Reqdescr column + Reqfldnotes column + Reqmapgrid column + Reqnotesforcust column + Reqnotesfortech column + Reqpermission column + Reqprogramactions column + Reqstate column + Reqsubdiv column + Reqtarget column + Reqzip column + Responsedaycount column + Reviewed column + Reviewedby column + Revieweddate column + Scheduled column + Scheduleddate column + Source column + SRNumber column + Status column + Supervisor column + Techclosed column + Validx column + Validy column + Xvalue column + Yvalue column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Dog column + Spanish column + ScheduleNotes column + SchedulePeriod column + Updated column +} + +func (c fsServicerequestColumns) 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.Updated, + } +} + +type fsServicerequestIndexes struct { + FSServicerequestPkey index +} + +func (i fsServicerequestIndexes) AsSlice() []index { + return []index{ + i.FSServicerequestPkey, + } +} + +type fsServicerequestForeignKeys struct { + FSServicerequestFSServicerequestOrganizationIDFkey foreignKey +} + +func (f fsServicerequestForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSServicerequestFSServicerequestOrganizationIDFkey, + } +} + +type fsServicerequestUniques struct{} + +func (u fsServicerequestUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsServicerequestChecks struct{} + +func (c fsServicerequestChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_speciesabundance.bob.go b/dbinfo/fs_speciesabundance.bob.go new file mode 100644 index 00000000..440f5f07 --- /dev/null +++ b/dbinfo/fs_speciesabundance.bob.go @@ -0,0 +1,427 @@ +// 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 FSSpeciesabundances = Table[ + fsSpeciesabundanceColumns, + fsSpeciesabundanceIndexes, + fsSpeciesabundanceForeignKeys, + fsSpeciesabundanceUniques, + fsSpeciesabundanceChecks, +]{ + Schema: "", + Name: "fs_speciesabundance", + Columns: fsSpeciesabundanceColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Bloodedfem: column{ + Name: "bloodedfem", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Eggs: column{ + Name: "eggs", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Females: column{ + Name: "females", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gravidfem: column{ + Name: "gravidfem", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvae: column{ + Name: "larvae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Males: column{ + Name: "males", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Poolstogen: column{ + Name: "poolstogen", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pupae: column{ + Name: "pupae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Total: column{ + Name: "total", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Unknown: column{ + Name: "unknown", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalzscore: column{ + Name: "globalzscore", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R7: column{ + Name: "h3r7", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R8: column{ + Name: "h3r8", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + R7score: column{ + Name: "r7score", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + R8score: column{ + Name: "r8score", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Yearweek: column{ + Name: "yearweek", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsSpeciesabundanceIndexes{ + FSSpeciesabundancePkey: index{ + Type: "btree", + Name: "fs_speciesabundance_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_speciesabundance_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsSpeciesabundanceForeignKeys{ + FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_speciesabundance.fs_speciesabundance_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsSpeciesabundanceColumns struct { + OrganizationID column + Bloodedfem column + Creationdate column + Creator column + Eggs column + Editdate column + Editor column + Females column + Gravidfem column + Globalid column + Larvae column + Males column + Objectid column + Poolstogen column + Processed column + Pupae column + Species column + Total column + TrapdataID column + Unknown column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Globalzscore column + H3R7 column + H3R8 column + R7score column + R8score column + Yearweek column + Updated column +} + +func (c fsSpeciesabundanceColumns) 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.Updated, + } +} + +type fsSpeciesabundanceIndexes struct { + FSSpeciesabundancePkey index +} + +func (i fsSpeciesabundanceIndexes) AsSlice() []index { + return []index{ + i.FSSpeciesabundancePkey, + } +} + +type fsSpeciesabundanceForeignKeys struct { + FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey foreignKey +} + +func (f fsSpeciesabundanceForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey, + } +} + +type fsSpeciesabundanceUniques struct{} + +func (u fsSpeciesabundanceUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsSpeciesabundanceChecks struct{} + +func (c fsSpeciesabundanceChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_stormdrain.bob.go b/dbinfo/fs_stormdrain.bob.go new file mode 100644 index 00000000..824578e9 --- /dev/null +++ b/dbinfo/fs_stormdrain.bob.go @@ -0,0 +1,327 @@ +// 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 FSStormdrains = Table[ + fsStormdrainColumns, + fsStormdrainIndexes, + fsStormdrainForeignKeys, + fsStormdrainUniques, + fsStormdrainChecks, +]{ + Schema: "", + Name: "fs_stormdrain", + Columns: fsStormdrainColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastaction: column{ + Name: "lastaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Laststatus: column{ + Name: "laststatus", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nexttreatmentdate: column{ + Name: "nexttreatmentdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsStormdrainIndexes{ + FSStormdrainPkey: index{ + Type: "btree", + Name: "fs_stormdrain_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_stormdrain_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsStormdrainForeignKeys{ + FSStormdrainFSStormdrainOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_stormdrain.fs_stormdrain_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsStormdrainColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Jurisdiction column + Lastaction column + Laststatus column + Lasttreatdate column + Nexttreatmentdate column + Objectid column + Symbology column + Type column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsStormdrainColumns) 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.Updated, + } +} + +type fsStormdrainIndexes struct { + FSStormdrainPkey index +} + +func (i fsStormdrainIndexes) AsSlice() []index { + return []index{ + i.FSStormdrainPkey, + } +} + +type fsStormdrainForeignKeys struct { + FSStormdrainFSStormdrainOrganizationIDFkey foreignKey +} + +func (f fsStormdrainForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSStormdrainFSStormdrainOrganizationIDFkey, + } +} + +type fsStormdrainUniques struct{} + +func (u fsStormdrainUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsStormdrainChecks struct{} + +func (c fsStormdrainChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_timecard.bob.go b/dbinfo/fs_timecard.bob.go new file mode 100644 index 00000000..1d14e9f3 --- /dev/null +++ b/dbinfo/fs_timecard.bob.go @@ -0,0 +1,417 @@ +// 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 FSTimecards = Table[ + fsTimecardColumns, + fsTimecardIndexes, + fsTimecardForeignKeys, + fsTimecardUniques, + fsTimecardChecks, +]{ + Schema: "", + Name: "fs_timecard", + Columns: fsTimecardColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Equiptype: column{ + Name: "equiptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lclocid: column{ + Name: "lclocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplelocid: column{ + Name: "samplelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Traplocid: column{ + Name: "traplocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rodentlocid: column{ + Name: "rodentlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsTimecardIndexes{ + FSTimecardPkey: index{ + Type: "btree", + Name: "fs_timecard_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_timecard_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsTimecardForeignKeys{ + FSTimecardFSTimecardOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_timecard.fs_timecard_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsTimecardColumns struct { + OrganizationID column + Activity column + Comments column + Creationdate column + Creator column + Enddatetime column + Equiptype column + Externalid column + Editdate column + Editor column + Fieldtech column + Globalid column + Lclocid column + Linelocid column + Locationname column + Objectid column + Pointlocid column + Polygonlocid column + Samplelocid column + Srid column + Startdatetime column + Traplocid column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Rodentlocid column + Updated column +} + +func (c fsTimecardColumns) 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.Updated, + } +} + +type fsTimecardIndexes struct { + FSTimecardPkey index +} + +func (i fsTimecardIndexes) AsSlice() []index { + return []index{ + i.FSTimecardPkey, + } +} + +type fsTimecardForeignKeys struct { + FSTimecardFSTimecardOrganizationIDFkey foreignKey +} + +func (f fsTimecardForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSTimecardFSTimecardOrganizationIDFkey, + } +} + +type fsTimecardUniques struct{} + +func (u fsTimecardUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsTimecardChecks struct{} + +func (c fsTimecardChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_trapdata.bob.go b/dbinfo/fs_trapdata.bob.go new file mode 100644 index 00000000..fa3ab9e5 --- /dev/null +++ b/dbinfo/fs_trapdata.bob.go @@ -0,0 +1,557 @@ +// 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 FSTrapdata = Table[ + fsTrapdatumColumns, + fsTrapdatumIndexes, + fsTrapdatumForeignKeys, + fsTrapdatumUniques, + fsTrapdatumChecks, +]{ + Schema: "", + Name: "fs_trapdata", + Columns: fsTrapdatumColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Field: column{ + Name: "field", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Idbytech: column{ + Name: "idbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LocID: column{ + Name: "loc_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LR: column{ + Name: "lr", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sortbytech: column{ + Name: "sortbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapactivitytype: column{ + Name: "trapactivitytype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapcondition: column{ + Name: "trapcondition", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapnights: column{ + Name: "trapnights", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Traptype: column{ + Name: "traptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Voltage: column{ + Name: "voltage", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lure: column{ + Name: "lure", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtrapdataid: column{ + Name: "vectorsurvtrapdataid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtraplocationid: column{ + Name: "vectorsurvtraplocationid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsTrapdatumIndexes{ + FSTrapdataPkey: index{ + Type: "btree", + Name: "fs_trapdata_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_trapdata_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsTrapdatumForeignKeys{ + FSTrapdataFSTrapdataOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_trapdata.fs_trapdata_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsTrapdatumColumns struct { + OrganizationID column + Avetemp column + Comments column + Creationdate column + Creator column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Field column + Gatewaysync column + Globalid column + Idbytech column + Locationname column + LocID column + LR column + Objectid column + Processed column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sitecond column + Sortbytech column + Srid column + Startdatetime column + Trapactivitytype column + Trapcondition column + Trapnights column + Traptype column + Voltage column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Lure column + Vectorsurvtrapdataid column + Vectorsurvtraplocationid column + Updated column +} + +func (c fsTrapdatumColumns) 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.Updated, + } +} + +type fsTrapdatumIndexes struct { + FSTrapdataPkey index +} + +func (i fsTrapdatumIndexes) AsSlice() []index { + return []index{ + i.FSTrapdataPkey, + } +} + +type fsTrapdatumForeignKeys struct { + FSTrapdataFSTrapdataOrganizationIDFkey foreignKey +} + +func (f fsTrapdatumForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSTrapdataFSTrapdataOrganizationIDFkey, + } +} + +type fsTrapdatumUniques struct{} + +func (u fsTrapdatumUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsTrapdatumChecks struct{} + +func (c fsTrapdatumChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_traplocation.bob.go b/dbinfo/fs_traplocation.bob.go new file mode 100644 index 00000000..b1df1a30 --- /dev/null +++ b/dbinfo/fs_traplocation.bob.go @@ -0,0 +1,437 @@ +// 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 FSTraplocations = Table[ + fsTraplocationColumns, + fsTraplocationIndexes, + fsTraplocationForeignKeys, + fsTraplocationUniques, + fsTraplocationChecks, +]{ + Schema: "", + Name: "fs_traplocation", + Columns: fsTraplocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Route: column{ + Name: "route", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RouteOrder: column{ + Name: "route_order", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SetDow: column{ + Name: "set_dow", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvsiteid: column{ + Name: "vectorsurvsiteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R7: column{ + Name: "h3r7", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R8: column{ + Name: "h3r8", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsTraplocationIndexes{ + FSTraplocationPkey: index{ + Type: "btree", + Name: "fs_traplocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_traplocation_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsTraplocationForeignKeys{ + FSTraplocationFSTraplocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_traplocation.fs_traplocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsTraplocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Gatewaysync column + Globalid column + Habitat column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Route column + RouteOrder column + SetDow column + Vectorsurvsiteid column + H3R7 column + H3R8 column + Updated column +} + +func (c fsTraplocationColumns) 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.Updated, + } +} + +type fsTraplocationIndexes struct { + FSTraplocationPkey index +} + +func (i fsTraplocationIndexes) AsSlice() []index { + return []index{ + i.FSTraplocationPkey, + } +} + +type fsTraplocationForeignKeys struct { + FSTraplocationFSTraplocationOrganizationIDFkey foreignKey +} + +func (f fsTraplocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSTraplocationFSTraplocationOrganizationIDFkey, + } +} + +type fsTraplocationUniques struct{} + +func (u fsTraplocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsTraplocationChecks struct{} + +func (c fsTraplocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_treatment.bob.go b/dbinfo/fs_treatment.bob.go new file mode 100644 index 00000000..cd310468 --- /dev/null +++ b/dbinfo/fs_treatment.bob.go @@ -0,0 +1,677 @@ +// 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 FSTreatments = Table[ + fsTreatmentColumns, + fsTreatmentIndexes, + fsTreatmentForeignKeys, + fsTreatmentUniques, + fsTreatmentChecks, +]{ + Schema: "", + Name: "fs_treatment", + Columns: fsTreatmentColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Areaunit: column{ + Name: "areaunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Barrierrouteid: column{ + Name: "barrierrouteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Cbcount: column{ + Name: "cbcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containercount: column{ + Name: "containercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Equiptype: column{ + Name: "equiptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flowrate: column{ + Name: "flowrate", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspID: column{ + Name: "insp_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Invloc: column{ + Name: "invloc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Method: column{ + Name: "method", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Product: column{ + Name: "product", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ptaid: column{ + Name: "ptaid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Qty: column{ + Name: "qty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Qtyunit: column{ + Name: "qtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sdid: column{ + Name: "sdid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetspecies: column{ + Name: "targetspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Tirecount: column{ + Name: "tirecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatacres: column{ + Name: "treatacres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatarea: column{ + Name: "treatarea", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treathectares: column{ + Name: "treathectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmenthours: column{ + Name: "treatmenthours", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmentlength: column{ + Name: "treatmentlength", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmentlengthunits: column{ + Name: "treatmentlengthunits", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totalcostprodcut: column{ + Name: "totalcostprodcut", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ulvrouteid: column{ + Name: "ulvrouteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Warningoverride: column{ + Name: "warningoverride", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TempSitecond: column{ + Name: "temp_sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsTreatmentIndexes{ + FSTreatmentPkey: index{ + Type: "btree", + Name: "fs_treatment_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_treatment_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsTreatmentForeignKeys{ + FSTreatmentFSTreatmentOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_treatment.fs_treatment_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsTreatmentColumns struct { + OrganizationID column + Activity column + Areaunit column + Avetemp column + Barrierrouteid column + Cbcount column + Comments column + Containercount column + Creationdate column + Creator column + Enddatetime column + Equiptype column + Editdate column + Editor column + Fieldtech column + Flowrate column + Globalid column + Habitat column + InspID column + Invloc column + Linelocid column + Locationname column + Method column + Objectid column + Pointlocid column + Polygonlocid column + Product column + Ptaid column + Qty column + Qtyunit column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sdid column + Sitecond column + Srid column + Startdatetime column + Targetspecies column + Tirecount column + Treatacres column + Treatarea column + Treathectares column + Treatmenthours column + Treatmentlength column + Treatmentlengthunits column + Totalcostprodcut column + Ulvrouteid column + Warningoverride column + Winddir column + Windspeed column + Zone column + Zone2 column + GeometryX column + GeometryY column + TempSitecond column + Updated column +} + +func (c fsTreatmentColumns) AsSlice() []column { + return []column{ + c.OrganizationID, c.Activity, c.Areaunit, c.Avetemp, c.Barrierrouteid, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Editdate, c.Editor, c.Fieldtech, c.Flowrate, c.Globalid, c.Habitat, c.InspID, c.Invloc, c.Linelocid, c.Locationname, c.Method, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Product, c.Ptaid, c.Qty, c.Qtyunit, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Targetspecies, c.Tirecount, c.Treatacres, c.Treatarea, c.Treathectares, c.Treatmenthours, c.Treatmentlength, c.Treatmentlengthunits, c.Totalcostprodcut, c.Ulvrouteid, c.Warningoverride, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.TempSitecond, c.Updated, + } +} + +type fsTreatmentIndexes struct { + FSTreatmentPkey index +} + +func (i fsTreatmentIndexes) AsSlice() []index { + return []index{ + i.FSTreatmentPkey, + } +} + +type fsTreatmentForeignKeys struct { + FSTreatmentFSTreatmentOrganizationIDFkey foreignKey +} + +func (f fsTreatmentForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSTreatmentFSTreatmentOrganizationIDFkey, + } +} + +type fsTreatmentUniques struct{} + +func (u fsTreatmentUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsTreatmentChecks struct{} + +func (c fsTreatmentChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_treatmentarea.bob.go b/dbinfo/fs_treatmentarea.bob.go new file mode 100644 index 00000000..9c1aadea --- /dev/null +++ b/dbinfo/fs_treatmentarea.bob.go @@ -0,0 +1,317 @@ +// 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 FSTreatmentareas = Table[ + fsTreatmentareaColumns, + fsTreatmentareaIndexes, + fsTreatmentareaForeignKeys, + fsTreatmentareaUniques, + fsTreatmentareaChecks, +]{ + Schema: "", + Name: "fs_treatmentarea", + Columns: fsTreatmentareaColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notified: column{ + Name: "notified", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + SessionID: column{ + Name: "session_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatdate: column{ + Name: "treatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TreatID: column{ + Name: "treat_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsTreatmentareaIndexes{ + FSTreatmentareaPkey: index{ + Type: "btree", + Name: "fs_treatmentarea_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_treatmentarea_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsTreatmentareaForeignKeys{ + FSTreatmentareaFSTreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_treatmentarea.fs_treatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsTreatmentareaColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Notified column + Objectid column + SessionID column + ShapeArea column + ShapeLength column + Treatdate column + TreatID column + Type column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsTreatmentareaColumns) 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.Updated, + } +} + +type fsTreatmentareaIndexes struct { + FSTreatmentareaPkey index +} + +func (i fsTreatmentareaIndexes) AsSlice() []index { + return []index{ + i.FSTreatmentareaPkey, + } +} + +type fsTreatmentareaForeignKeys struct { + FSTreatmentareaFSTreatmentareaOrganizationIDFkey foreignKey +} + +func (f fsTreatmentareaForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSTreatmentareaFSTreatmentareaOrganizationIDFkey, + } +} + +type fsTreatmentareaUniques struct{} + +func (u fsTreatmentareaUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsTreatmentareaChecks struct{} + +func (c fsTreatmentareaChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_zones.bob.go b/dbinfo/fs_zones.bob.go new file mode 100644 index 00000000..97458f4c --- /dev/null +++ b/dbinfo/fs_zones.bob.go @@ -0,0 +1,277 @@ +// 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 FSZones = Table[ + fsZoneColumns, + fsZoneIndexes, + fsZoneForeignKeys, + fsZoneUniques, + fsZoneChecks, +]{ + Schema: "", + Name: "fs_zones", + Columns: fsZoneColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsZoneIndexes{ + FSZonesPkey: index{ + Type: "btree", + Name: "fs_zones_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_zones_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsZoneForeignKeys{ + FSZonesFSZonesOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_zones.fs_zones_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsZoneColumns struct { + OrganizationID column + Active column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Name column + Objectid column + ShapeArea column + ShapeLength column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsZoneColumns) 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.Updated, + } +} + +type fsZoneIndexes struct { + FSZonesPkey index +} + +func (i fsZoneIndexes) AsSlice() []index { + return []index{ + i.FSZonesPkey, + } +} + +type fsZoneForeignKeys struct { + FSZonesFSZonesOrganizationIDFkey foreignKey +} + +func (f fsZoneForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSZonesFSZonesOrganizationIDFkey, + } +} + +type fsZoneUniques struct{} + +func (u fsZoneUniques) AsSlice() []constraint { + return []constraint{} +} + +type fsZoneChecks struct{} + +func (c fsZoneChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_zones2.bob.go b/dbinfo/fs_zones2.bob.go new file mode 100644 index 00000000..08e8b000 --- /dev/null +++ b/dbinfo/fs_zones2.bob.go @@ -0,0 +1,267 @@ +// 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 FSZones2s = Table[ + fsZones2Columns, + fsZones2Indexes, + fsZones2ForeignKeys, + fsZones2Uniques, + fsZones2Checks, +]{ + Schema: "", + Name: "fs_zones2", + Columns: fsZones2Columns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Updated: column{ + Name: "updated", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fsZones2Indexes{ + FSZones2Pkey: index{ + Type: "btree", + Name: "fs_zones2_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fs_zones2_pkey", + Columns: []string{"objectid"}, + Comment: "", + }, + ForeignKeys: fsZones2ForeignKeys{ + FSZones2FSZones2OrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fs_zones2.fs_zones2_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fsZones2Columns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Name column + Objectid column + ShapeArea column + ShapeLength column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Updated column +} + +func (c fsZones2Columns) 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.Updated, + } +} + +type fsZones2Indexes struct { + FSZones2Pkey index +} + +func (i fsZones2Indexes) AsSlice() []index { + return []index{ + i.FSZones2Pkey, + } +} + +type fsZones2ForeignKeys struct { + FSZones2FSZones2OrganizationIDFkey foreignKey +} + +func (f fsZones2ForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FSZones2FSZones2OrganizationIDFkey, + } +} + +type fsZones2Uniques struct{} + +func (u fsZones2Uniques) AsSlice() []constraint { + return []constraint{} +} + +type fsZones2Checks struct{} + +func (c fsZones2Checks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_containerrelate.bob.go b/dbinfo/history_containerrelate.bob.go new file mode 100644 index 00000000..6b851a22 --- /dev/null +++ b/dbinfo/history_containerrelate.bob.go @@ -0,0 +1,282 @@ +// 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 HistoryContainerrelates = Table[ + historyContainerrelateColumns, + historyContainerrelateIndexes, + historyContainerrelateForeignKeys, + historyContainerrelateUniques, + historyContainerrelateChecks, +]{ + Schema: "", + Name: "history_containerrelate", + Columns: historyContainerrelateColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containertype: column{ + Name: "containertype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Inspsampleid: column{ + Name: "inspsampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Mosquitoinspid: column{ + Name: "mosquitoinspid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Treatmentid: column{ + Name: "treatmentid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyContainerrelateIndexes{ + HistoryContainerrelatePkey: index{ + Type: "btree", + Name: "history_containerrelate_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_containerrelate_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyContainerrelateForeignKeys{ + HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_containerrelate.history_containerrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyContainerrelateColumns struct { + OrganizationID column + Containertype column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Inspsampleid column + Mosquitoinspid column + Objectid column + Treatmentid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyContainerrelateIndexes struct { + HistoryContainerrelatePkey index +} + +func (i historyContainerrelateIndexes) AsSlice() []index { + return []index{ + i.HistoryContainerrelatePkey, + } +} + +type historyContainerrelateForeignKeys struct { + HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey foreignKey +} + +func (f historyContainerrelateForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey, + } +} + +type historyContainerrelateUniques struct{} + +func (u historyContainerrelateUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyContainerrelateChecks struct{} + +func (c historyContainerrelateChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_fieldscoutinglog.bob.go b/dbinfo/history_fieldscoutinglog.bob.go new file mode 100644 index 00000000..bb8f322d --- /dev/null +++ b/dbinfo/history_fieldscoutinglog.bob.go @@ -0,0 +1,252 @@ +// 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 HistoryFieldscoutinglogs = Table[ + historyFieldscoutinglogColumns, + historyFieldscoutinglogIndexes, + historyFieldscoutinglogForeignKeys, + historyFieldscoutinglogUniques, + historyFieldscoutinglogChecks, +]{ + Schema: "", + Name: "history_fieldscoutinglog", + Columns: historyFieldscoutinglogColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Status: column{ + Name: "status", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyFieldscoutinglogIndexes{ + HistoryFieldscoutinglogPkey: index{ + Type: "btree", + Name: "history_fieldscoutinglog_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_fieldscoutinglog_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyFieldscoutinglogForeignKeys{ + HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyFieldscoutinglogColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Objectid column + Status column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyFieldscoutinglogIndexes struct { + HistoryFieldscoutinglogPkey index +} + +func (i historyFieldscoutinglogIndexes) AsSlice() []index { + return []index{ + i.HistoryFieldscoutinglogPkey, + } +} + +type historyFieldscoutinglogForeignKeys struct { + HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey foreignKey +} + +func (f historyFieldscoutinglogForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey, + } +} + +type historyFieldscoutinglogUniques struct{} + +func (u historyFieldscoutinglogUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyFieldscoutinglogChecks struct{} + +func (c historyFieldscoutinglogChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_habitatrelate.bob.go b/dbinfo/history_habitatrelate.bob.go new file mode 100644 index 00000000..1da0e98a --- /dev/null +++ b/dbinfo/history_habitatrelate.bob.go @@ -0,0 +1,262 @@ +// 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 HistoryHabitatrelates = Table[ + historyHabitatrelateColumns, + historyHabitatrelateIndexes, + historyHabitatrelateForeignKeys, + historyHabitatrelateUniques, + historyHabitatrelateChecks, +]{ + Schema: "", + Name: "history_habitatrelate", + Columns: historyHabitatrelateColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ForeignID: column{ + Name: "foreign_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitattype: column{ + Name: "habitattype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyHabitatrelateIndexes{ + HistoryHabitatrelatePkey: index{ + Type: "btree", + Name: "history_habitatrelate_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_habitatrelate_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyHabitatrelateForeignKeys{ + HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_habitatrelate.history_habitatrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyHabitatrelateColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + ForeignID column + Globalid column + Habitattype column + Objectid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyHabitatrelateIndexes struct { + HistoryHabitatrelatePkey index +} + +func (i historyHabitatrelateIndexes) AsSlice() []index { + return []index{ + i.HistoryHabitatrelatePkey, + } +} + +type historyHabitatrelateForeignKeys struct { + HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey foreignKey +} + +func (f historyHabitatrelateForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey, + } +} + +type historyHabitatrelateUniques struct{} + +func (u historyHabitatrelateUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyHabitatrelateChecks struct{} + +func (c historyHabitatrelateChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_inspectionsample.bob.go b/dbinfo/history_inspectionsample.bob.go new file mode 100644 index 00000000..0b89b92a --- /dev/null +++ b/dbinfo/history_inspectionsample.bob.go @@ -0,0 +1,282 @@ +// 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 HistoryInspectionsamples = Table[ + historyInspectionsampleColumns, + historyInspectionsampleIndexes, + historyInspectionsampleForeignKeys, + historyInspectionsampleUniques, + historyInspectionsampleChecks, +]{ + Schema: "", + Name: "history_inspectionsample", + Columns: historyInspectionsampleColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Idbytech: column{ + Name: "idbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspID: column{ + Name: "insp_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyInspectionsampleIndexes{ + HistoryInspectionsamplePkey: index{ + Type: "btree", + Name: "history_inspectionsample_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_inspectionsample_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyInspectionsampleForeignKeys{ + HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_inspectionsample.history_inspectionsample_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyInspectionsampleColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Idbytech column + InspID column + Objectid column + Processed column + Sampleid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyInspectionsampleIndexes struct { + HistoryInspectionsamplePkey index +} + +func (i historyInspectionsampleIndexes) AsSlice() []index { + return []index{ + i.HistoryInspectionsamplePkey, + } +} + +type historyInspectionsampleForeignKeys struct { + HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey foreignKey +} + +func (f historyInspectionsampleForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey, + } +} + +type historyInspectionsampleUniques struct{} + +func (u historyInspectionsampleUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyInspectionsampleChecks struct{} + +func (c historyInspectionsampleChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_inspectionsampledetail.bob.go b/dbinfo/history_inspectionsampledetail.bob.go new file mode 100644 index 00000000..801d39d1 --- /dev/null +++ b/dbinfo/history_inspectionsampledetail.bob.go @@ -0,0 +1,392 @@ +// 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 HistoryInspectionsampledetails = Table[ + historyInspectionsampledetailColumns, + historyInspectionsampledetailIndexes, + historyInspectionsampledetailForeignKeys, + historyInspectionsampledetailUniques, + historyInspectionsampledetailChecks, +]{ + Schema: "", + Name: "history_inspectionsampledetail", + Columns: historyInspectionsampledetailColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fadultact: column{ + Name: "fadultact", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fdomstage: column{ + Name: "fdomstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Feggcount: column{ + Name: "feggcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldspecies: column{ + Name: "fieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flarvcount: column{ + Name: "flarvcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flstages: column{ + Name: "flstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fpupcount: column{ + Name: "fpupcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspsampleID: column{ + Name: "inspsample_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Labspecies: column{ + Name: "labspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ldomstage: column{ + Name: "ldomstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Leggcount: column{ + Name: "leggcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Llarvcount: column{ + Name: "llarvcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lpupcount: column{ + Name: "lpupcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyInspectionsampledetailIndexes{ + HistoryInspectionsampledetailPkey: index{ + Type: "btree", + Name: "history_inspectionsampledetail_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_inspectionsampledetail_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyInspectionsampledetailForeignKeys{ + HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyInspectionsampledetailColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Editdate column + Editor column + Fadultact column + Fdomstage column + Feggcount column + Fieldspecies column + Flarvcount column + Flstages column + Fpupcount column + Globalid column + InspsampleID column + Labspecies column + Ldomstage column + Leggcount column + Llarvcount column + Lpupcount column + Objectid column + Processed column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyInspectionsampledetailIndexes struct { + HistoryInspectionsampledetailPkey index +} + +func (i historyInspectionsampledetailIndexes) AsSlice() []index { + return []index{ + i.HistoryInspectionsampledetailPkey, + } +} + +type historyInspectionsampledetailForeignKeys struct { + HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey foreignKey +} + +func (f historyInspectionsampledetailForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey, + } +} + +type historyInspectionsampledetailUniques struct{} + +func (u historyInspectionsampledetailUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyInspectionsampledetailChecks struct{} + +func (c historyInspectionsampledetailChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_linelocation.bob.go b/dbinfo/history_linelocation.bob.go new file mode 100644 index 00000000..fa52455c --- /dev/null +++ b/dbinfo/history_linelocation.bob.go @@ -0,0 +1,622 @@ +// 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 HistoryLinelocations = Table[ + historyLinelocationColumns, + historyLinelocationIndexes, + historyLinelocationForeignKeys, + historyLinelocationUniques, + historyLinelocationChecks, +]{ + Schema: "", + Name: "history_linelocation", + Columns: historyLinelocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LengthFT: column{ + Name: "length_ft", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LengthMeters: column{ + Name: "length_meters", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + WidthFT: column{ + Name: "width_ft", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + WidthMeters: column{ + Name: "width_meters", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyLinelocationIndexes{ + HistoryLinelocationPkey: index{ + Type: "btree", + Name: "history_linelocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_linelocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyLinelocationForeignKeys{ + HistoryLinelocationHistoryLinelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_linelocation.history_linelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyLinelocationColumns struct { + OrganizationID column + Accessdesc column + Acres column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Hectares column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + LengthFT column + LengthMeters column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + ShapeLength column + Usetype column + Waterorigin column + WidthFT column + WidthMeters column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyLinelocationIndexes struct { + HistoryLinelocationPkey index +} + +func (i historyLinelocationIndexes) AsSlice() []index { + return []index{ + i.HistoryLinelocationPkey, + } +} + +type historyLinelocationForeignKeys struct { + HistoryLinelocationHistoryLinelocationOrganizationIDFkey foreignKey +} + +func (f historyLinelocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryLinelocationHistoryLinelocationOrganizationIDFkey, + } +} + +type historyLinelocationUniques struct{} + +func (u historyLinelocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyLinelocationChecks struct{} + +func (c historyLinelocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_locationtracking.bob.go b/dbinfo/history_locationtracking.bob.go new file mode 100644 index 00000000..3e4db938 --- /dev/null +++ b/dbinfo/history_locationtracking.bob.go @@ -0,0 +1,262 @@ +// 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 HistoryLocationtrackings = Table[ + historyLocationtrackingColumns, + historyLocationtrackingIndexes, + historyLocationtrackingForeignKeys, + historyLocationtrackingUniques, + historyLocationtrackingChecks, +]{ + Schema: "", + Name: "history_locationtracking", + Columns: historyLocationtrackingColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accuracy: column{ + Name: "accuracy", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyLocationtrackingIndexes{ + HistoryLocationtrackingPkey: index{ + Type: "btree", + Name: "history_locationtracking_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_locationtracking_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyLocationtrackingForeignKeys{ + HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_locationtracking.history_locationtracking_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyLocationtrackingColumns struct { + OrganizationID column + Accuracy column + Creationdate column + Creator column + Editdate column + Editor column + Fieldtech column + Globalid column + Objectid column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyLocationtrackingIndexes struct { + HistoryLocationtrackingPkey index +} + +func (i historyLocationtrackingIndexes) AsSlice() []index { + return []index{ + i.HistoryLocationtrackingPkey, + } +} + +type historyLocationtrackingForeignKeys struct { + HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey foreignKey +} + +func (f historyLocationtrackingForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey, + } +} + +type historyLocationtrackingUniques struct{} + +func (u historyLocationtrackingUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyLocationtrackingChecks struct{} + +func (c historyLocationtrackingChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_mosquitoinspection.bob.go b/dbinfo/history_mosquitoinspection.bob.go new file mode 100644 index 00000000..0c48caa3 --- /dev/null +++ b/dbinfo/history_mosquitoinspection.bob.go @@ -0,0 +1,712 @@ +// 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 HistoryMosquitoinspections = Table[ + historyMosquitoinspectionColumns, + historyMosquitoinspectionIndexes, + historyMosquitoinspectionForeignKeys, + historyMosquitoinspectionUniques, + historyMosquitoinspectionChecks, +]{ + Schema: "", + Name: "history_mosquitoinspection", + Columns: historyMosquitoinspectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Actiontaken: column{ + Name: "actiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adultact: column{ + Name: "adultact", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avglarvae: column{ + Name: "avglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avgpupae: column{ + Name: "avgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Breeding: column{ + Name: "breeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Cbcount: column{ + Name: "cbcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containercount: column{ + Name: "containercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Domstage: column{ + Name: "domstage", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Eggs: column{ + Name: "eggs", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldspecies: column{ + Name: "fieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaepresent: column{ + Name: "larvaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lstages: column{ + Name: "lstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Numdips: column{ + Name: "numdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Personalcontact: column{ + Name: "personalcontact", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Posdips: column{ + Name: "posdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Positivecontainercount: column{ + Name: "positivecontainercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pupaepresent: column{ + Name: "pupaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sdid: column{ + Name: "sdid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Tirecount: column{ + Name: "tirecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totlarvae: column{ + Name: "totlarvae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totpupae: column{ + Name: "totpupae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Visualmonitoring: column{ + Name: "visualmonitoring", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vmcomments: column{ + Name: "vmcomments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adminaction: column{ + Name: "adminaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ptaid: column{ + Name: "ptaid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyMosquitoinspectionIndexes{ + HistoryMosquitoinspectionPkey: index{ + Type: "btree", + Name: "history_mosquitoinspection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_mosquitoinspection_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyMosquitoinspectionForeignKeys{ + HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyMosquitoinspectionColumns struct { + OrganizationID column + Actiontaken column + Activity column + Adultact column + Avetemp column + Avglarvae column + Avgpupae column + Breeding column + Cbcount column + Comments column + Containercount column + Creationdate column + Creator column + Domstage column + Eggs column + Enddatetime column + Editdate column + Editor column + Fieldspecies column + Fieldtech column + Globalid column + Jurisdiction column + Larvaepresent column + Linelocid column + Locationname column + Lstages column + Numdips column + Objectid column + Personalcontact column + Pointlocid column + Polygonlocid column + Posdips column + Positivecontainercount column + Pupaepresent column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sdid column + Sitecond column + Srid column + Startdatetime column + Tirecount column + Totlarvae column + Totpupae column + Visualmonitoring column + Vmcomments column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Adminaction column + Ptaid column + Version column +} + +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, + } +} + +type historyMosquitoinspectionIndexes struct { + HistoryMosquitoinspectionPkey index +} + +func (i historyMosquitoinspectionIndexes) AsSlice() []index { + return []index{ + i.HistoryMosquitoinspectionPkey, + } +} + +type historyMosquitoinspectionForeignKeys struct { + HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey foreignKey +} + +func (f historyMosquitoinspectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey, + } +} + +type historyMosquitoinspectionUniques struct{} + +func (u historyMosquitoinspectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyMosquitoinspectionChecks struct{} + +func (c historyMosquitoinspectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_pointlocation.bob.go b/dbinfo/history_pointlocation.bob.go new file mode 100644 index 00000000..6762763f --- /dev/null +++ b/dbinfo/history_pointlocation.bob.go @@ -0,0 +1,582 @@ +// 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 HistoryPointlocations = Table[ + historyPointlocationColumns, + historyPointlocationIndexes, + historyPointlocationForeignKeys, + historyPointlocationUniques, + historyPointlocationChecks, +]{ + Schema: "", + Name: "history_pointlocation", + Columns: historyPointlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Stype: column{ + Name: "stype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + X: column{ + Name: "x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Y: column{ + Name: "y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Assignedtech: column{ + Name: "assignedtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + DeactivateReason: column{ + Name: "deactivate_reason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scalarpriority: column{ + Name: "scalarpriority", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sourcestatus: column{ + Name: "sourcestatus", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyPointlocationIndexes{ + HistoryPointlocationPkey: index{ + Type: "btree", + Name: "history_pointlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_pointlocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyPointlocationForeignKeys{ + HistoryPointlocationHistoryPointlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_pointlocation.history_pointlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyPointlocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Stype column + Symbology column + Usetype column + Waterorigin column + X column + Y column + Zone column + Zone2 column + GeometryX column + GeometryY column + Assignedtech column + DeactivateReason column + Scalarpriority column + Sourcestatus column + Version column +} + +func (c historyPointlocationColumns) 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.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.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Stype, c.Symbology, c.Usetype, c.Waterorigin, c.X, c.Y, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Assignedtech, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Version, + } +} + +type historyPointlocationIndexes struct { + HistoryPointlocationPkey index +} + +func (i historyPointlocationIndexes) AsSlice() []index { + return []index{ + i.HistoryPointlocationPkey, + } +} + +type historyPointlocationForeignKeys struct { + HistoryPointlocationHistoryPointlocationOrganizationIDFkey foreignKey +} + +func (f historyPointlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryPointlocationHistoryPointlocationOrganizationIDFkey, + } +} + +type historyPointlocationUniques struct{} + +func (u historyPointlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyPointlocationChecks struct{} + +func (c historyPointlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_polygonlocation.bob.go b/dbinfo/history_polygonlocation.bob.go new file mode 100644 index 00000000..3bc4c17b --- /dev/null +++ b/dbinfo/history_polygonlocation.bob.go @@ -0,0 +1,562 @@ +// 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 HistoryPolygonlocations = Table[ + historyPolygonlocationColumns, + historyPolygonlocationIndexes, + historyPolygonlocationForeignKeys, + historyPolygonlocationUniques, + historyPolygonlocationChecks, +]{ + Schema: "", + Name: "history_polygonlocation", + Columns: historyPolygonlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Filter: column{ + Name: "filter", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvinspectinterval: column{ + Name: "larvinspectinterval", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactiontaken: column{ + Name: "lastinspectactiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectactivity: column{ + Name: "lastinspectactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavglarvae: column{ + Name: "lastinspectavglarvae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectavgpupae: column{ + Name: "lastinspectavgpupae", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectbreeding: column{ + Name: "lastinspectbreeding", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectfieldspecies: column{ + Name: "lastinspectfieldspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectlstages: column{ + Name: "lastinspectlstages", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterorigin: column{ + Name: "waterorigin", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyPolygonlocationIndexes{ + HistoryPolygonlocationPkey: index{ + Type: "btree", + Name: "history_polygonlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_polygonlocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyPolygonlocationForeignKeys{ + HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_polygonlocation.history_polygonlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyPolygonlocationColumns struct { + OrganizationID column + Accessdesc column + Acres column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Filter column + Globalid column + Habitat column + Hectares column + Jurisdiction column + Larvinspectinterval column + Lastinspectactiontaken column + Lastinspectactivity column + Lastinspectavglarvae column + Lastinspectavgpupae column + Lastinspectbreeding column + Lastinspectconditions column + Lastinspectdate column + Lastinspectfieldspecies column + Lastinspectlstages column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + ShapeArea column + ShapeLength column + Usetype column + Waterorigin column + Zone column + Zone2 column + GeometryX column + GeometryY column + Version column +} + +func (c historyPolygonlocationColumns) 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.Filter, 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.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeArea, c.ShapeLength, c.Usetype, c.Waterorigin, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Version, + } +} + +type historyPolygonlocationIndexes struct { + HistoryPolygonlocationPkey index +} + +func (i historyPolygonlocationIndexes) AsSlice() []index { + return []index{ + i.HistoryPolygonlocationPkey, + } +} + +type historyPolygonlocationForeignKeys struct { + HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey foreignKey +} + +func (f historyPolygonlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey, + } +} + +type historyPolygonlocationUniques struct{} + +func (u historyPolygonlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyPolygonlocationChecks struct{} + +func (c historyPolygonlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_pool.bob.go b/dbinfo/history_pool.bob.go new file mode 100644 index 00000000..b689dd0a --- /dev/null +++ b/dbinfo/history_pool.bob.go @@ -0,0 +1,422 @@ +// 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 HistoryPools = Table[ + historyPoolColumns, + historyPoolIndexes, + historyPoolForeignKeys, + historyPoolUniques, + historyPoolChecks, +]{ + Schema: "", + Name: "history_pool", + Columns: historyPoolColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datesent: column{ + Name: "datesent", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetested: column{ + Name: "datetested", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasepos: column{ + Name: "diseasepos", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasetested: column{ + Name: "diseasetested", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lab: column{ + Name: "lab", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LabID: column{ + Name: "lab_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Poolyear: column{ + Name: "poolyear", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Survtech: column{ + Name: "survtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testmethod: column{ + Name: "testmethod", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testtech: column{ + Name: "testtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvcollectionid: column{ + Name: "vectorsurvcollectionid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvpoolid: column{ + Name: "vectorsurvpoolid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtrapdataid: column{ + Name: "vectorsurvtrapdataid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyPoolIndexes{ + HistoryPoolPkey: index{ + Type: "btree", + Name: "history_pool_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_pool_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyPoolForeignKeys{ + HistoryPoolHistoryPoolOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_pool.history_pool_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyPoolColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Datesent column + Datetested column + Diseasepos column + Diseasetested column + Editdate column + Editor column + Gatewaysync column + Globalid column + Lab column + LabID column + Objectid column + Poolyear column + Processed column + Sampleid column + Survtech column + Testmethod column + Testtech column + TrapdataID column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Vectorsurvcollectionid column + Vectorsurvpoolid column + Vectorsurvtrapdataid column + Version column +} + +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, + } +} + +type historyPoolIndexes struct { + HistoryPoolPkey index +} + +func (i historyPoolIndexes) AsSlice() []index { + return []index{ + i.HistoryPoolPkey, + } +} + +type historyPoolForeignKeys struct { + HistoryPoolHistoryPoolOrganizationIDFkey foreignKey +} + +func (f historyPoolForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryPoolHistoryPoolOrganizationIDFkey, + } +} + +type historyPoolUniques struct{} + +func (u historyPoolUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyPoolChecks struct{} + +func (c historyPoolChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_pooldetail.bob.go b/dbinfo/history_pooldetail.bob.go new file mode 100644 index 00000000..d56878b3 --- /dev/null +++ b/dbinfo/history_pooldetail.bob.go @@ -0,0 +1,282 @@ +// 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 HistoryPooldetails = Table[ + historyPooldetailColumns, + historyPooldetailIndexes, + historyPooldetailForeignKeys, + historyPooldetailUniques, + historyPooldetailChecks, +]{ + Schema: "", + Name: "history_pooldetail", + Columns: historyPooldetailColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Females: column{ + Name: "females", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + PoolID: column{ + Name: "pool_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyPooldetailIndexes{ + HistoryPooldetailPkey: index{ + Type: "btree", + Name: "history_pooldetail_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_pooldetail_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyPooldetailForeignKeys{ + HistoryPooldetailHistoryPooldetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_pooldetail.history_pooldetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyPooldetailColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Females column + Globalid column + Objectid column + PoolID column + Species column + TrapdataID column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyPooldetailIndexes struct { + HistoryPooldetailPkey index +} + +func (i historyPooldetailIndexes) AsSlice() []index { + return []index{ + i.HistoryPooldetailPkey, + } +} + +type historyPooldetailForeignKeys struct { + HistoryPooldetailHistoryPooldetailOrganizationIDFkey foreignKey +} + +func (f historyPooldetailForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryPooldetailHistoryPooldetailOrganizationIDFkey, + } +} + +type historyPooldetailUniques struct{} + +func (u historyPooldetailUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyPooldetailChecks struct{} + +func (c historyPooldetailChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_proposedtreatmentarea.bob.go b/dbinfo/history_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..c172c26c --- /dev/null +++ b/dbinfo/history_proposedtreatmentarea.bob.go @@ -0,0 +1,472 @@ +// 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 HistoryProposedtreatmentareas = Table[ + historyProposedtreatmentareaColumns, + historyProposedtreatmentareaIndexes, + historyProposedtreatmentareaForeignKeys, + historyProposedtreatmentareaUniques, + historyProposedtreatmentareaChecks, +]{ + Schema: "", + Name: "history_proposedtreatmentarea", + Columns: historyProposedtreatmentareaColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acres: column{ + Name: "acres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completed: column{ + Name: "completed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completedby: column{ + Name: "completedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Completeddate: column{ + Name: "completeddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Duedate: column{ + Name: "duedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Exported: column{ + Name: "exported", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Hectares: column{ + Name: "hectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Issprayroute: column{ + Name: "issprayroute", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatactivity: column{ + Name: "lasttreatactivity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatproduct: column{ + Name: "lasttreatproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqty: column{ + Name: "lasttreatqty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatqtyunit: column{ + Name: "lasttreatqtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Method: column{ + Name: "method", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetapprate: column{ + Name: "targetapprate", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetproduct: column{ + Name: "targetproduct", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetspecies: column{ + Name: "targetspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyProposedtreatmentareaIndexes{ + HistoryProposedtreatmentareaPkey: index{ + Type: "btree", + Name: "history_proposedtreatmentarea_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_proposedtreatmentarea_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyProposedtreatmentareaForeignKeys{ + HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyProposedtreatmentareaColumns struct { + OrganizationID column + Acres column + Comments column + Completed column + Completedby column + Completeddate column + Creationdate column + Creator column + Duedate column + Exported column + Editdate column + Editor column + Globalid column + Hectares column + Issprayroute column + Lasttreatactivity column + Lasttreatdate column + Lasttreatproduct column + Lasttreatqty column + Lasttreatqtyunit column + Method column + Name column + Objectid column + Priority column + Reviewed column + Reviewedby column + Revieweddate column + ShapeArea column + ShapeLength column + Targetapprate column + Targetproduct column + Targetspecies column + Zone column + Zone2 column + GeometryX column + GeometryY column + Version column +} + +func (c historyProposedtreatmentareaColumns) AsSlice() []column { + return []column{ + c.OrganizationID, c.Acres, c.Comments, c.Completed, c.Completedby, c.Completeddate, c.Creationdate, c.Creator, c.Duedate, c.Exported, c.Editdate, c.Editor, c.Globalid, c.Hectares, c.Issprayroute, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Method, c.Name, c.Objectid, c.Priority, c.Reviewed, c.Reviewedby, c.Revieweddate, c.ShapeArea, c.ShapeLength, c.Targetapprate, c.Targetproduct, c.Targetspecies, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Version, + } +} + +type historyProposedtreatmentareaIndexes struct { + HistoryProposedtreatmentareaPkey index +} + +func (i historyProposedtreatmentareaIndexes) AsSlice() []index { + return []index{ + i.HistoryProposedtreatmentareaPkey, + } +} + +type historyProposedtreatmentareaForeignKeys struct { + HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey foreignKey +} + +func (f historyProposedtreatmentareaForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey, + } +} + +type historyProposedtreatmentareaUniques struct{} + +func (u historyProposedtreatmentareaUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyProposedtreatmentareaChecks struct{} + +func (c historyProposedtreatmentareaChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_qamosquitoinspection.bob.go b/dbinfo/history_qamosquitoinspection.bob.go new file mode 100644 index 00000000..da6d6863 --- /dev/null +++ b/dbinfo/history_qamosquitoinspection.bob.go @@ -0,0 +1,762 @@ +// 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 HistoryQamosquitoinspections = Table[ + historyQamosquitoinspectionColumns, + historyQamosquitoinspectionIndexes, + historyQamosquitoinspectionForeignKeys, + historyQamosquitoinspectionUniques, + historyQamosquitoinspectionChecks, +]{ + Schema: "", + Name: "history_qamosquitoinspection", + Columns: historyQamosquitoinspectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acresbreeding: column{ + Name: "acresbreeding", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Actiontaken: column{ + Name: "actiontaken", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Adultactivity: column{ + Name: "adultactivity", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Aquaticorganisms: column{ + Name: "aquaticorganisms", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Breedingpotential: column{ + Name: "breedingpotential", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fish: column{ + Name: "fish", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue1: column{ + Name: "habvalue1", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue1percent: column{ + Name: "habvalue1percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue2: column{ + Name: "habvalue2", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habvalue2percent: column{ + Name: "habvalue2percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaeinsidetreatedarea: column{ + Name: "larvaeinsidetreatedarea", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaeoutsidetreatedarea: column{ + Name: "larvaeoutsidetreatedarea", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaepresent: column{ + Name: "larvaepresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvaereason: column{ + Name: "larvaereason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LR: column{ + Name: "lr", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Mosquitohabitat: column{ + Name: "mosquitohabitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Movingwater: column{ + Name: "movingwater", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Negdips: column{ + Name: "negdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nowaterever: column{ + Name: "nowaterever", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Posdips: column{ + Name: "posdips", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Potential: column{ + Name: "potential", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitetype: column{ + Name: "sitetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Soilconditions: column{ + Name: "soilconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sourcereduction: column{ + Name: "sourcereduction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totalacres: column{ + Name: "totalacres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vegetation: column{ + Name: "vegetation", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterconditions: column{ + Name: "waterconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterduration: column{ + Name: "waterduration", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement1: column{ + Name: "watermovement1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement1percent: column{ + Name: "watermovement1percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement2: column{ + Name: "watermovement2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watermovement2percent: column{ + Name: "watermovement2percent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Waterpresent: column{ + Name: "waterpresent", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Watersource: column{ + Name: "watersource", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyQamosquitoinspectionIndexes{ + HistoryQamosquitoinspectionPkey: index{ + Type: "btree", + Name: "history_qamosquitoinspection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_qamosquitoinspection_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyQamosquitoinspectionForeignKeys{ + HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyQamosquitoinspectionColumns struct { + OrganizationID column + Acresbreeding column + Actiontaken column + Adultactivity column + Aquaticorganisms column + Avetemp column + Breedingpotential column + Comments column + Creationdate column + Creator column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Fish column + Globalid column + Habvalue1 column + Habvalue1percent column + Habvalue2 column + Habvalue2percent column + Larvaeinsidetreatedarea column + Larvaeoutsidetreatedarea column + Larvaepresent column + Larvaereason column + Linelocid column + Locationname column + LR column + Mosquitohabitat column + Movingwater column + Negdips column + Nowaterever column + Objectid column + Pointlocid column + Polygonlocid column + Posdips column + Potential column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sitetype column + Soilconditions column + Sourcereduction column + Startdatetime column + Totalacres column + Vegetation column + Waterconditions column + Waterduration column + Watermovement1 column + Watermovement1percent column + Watermovement2 column + Watermovement2percent column + Waterpresent column + Watersource column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyQamosquitoinspectionIndexes struct { + HistoryQamosquitoinspectionPkey index +} + +func (i historyQamosquitoinspectionIndexes) AsSlice() []index { + return []index{ + i.HistoryQamosquitoinspectionPkey, + } +} + +type historyQamosquitoinspectionForeignKeys struct { + HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey foreignKey +} + +func (f historyQamosquitoinspectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey, + } +} + +type historyQamosquitoinspectionUniques struct{} + +func (u historyQamosquitoinspectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyQamosquitoinspectionChecks struct{} + +func (c historyQamosquitoinspectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_rodentlocation.bob.go b/dbinfo/history_rodentlocation.bob.go new file mode 100644 index 00000000..d1ccba23 --- /dev/null +++ b/dbinfo/history_rodentlocation.bob.go @@ -0,0 +1,442 @@ +// 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 HistoryRodentlocations = Table[ + historyRodentlocationColumns, + historyRodentlocationIndexes, + historyRodentlocationForeignKeys, + historyRodentlocationUniques, + historyRodentlocationChecks, +]{ + Schema: "", + Name: "history_rodentlocation", + Columns: historyRodentlocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectaction: column{ + Name: "lastinspectaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectconditions: column{ + Name: "lastinspectconditions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectdate: column{ + Name: "lastinspectdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectrodentevidence: column{ + Name: "lastinspectrodentevidence", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastinspectspecies: column{ + Name: "lastinspectspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyRodentlocationIndexes{ + HistoryRodentlocationPkey: index{ + Type: "btree", + Name: "history_rodentlocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_rodentlocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyRodentlocationForeignKeys{ + HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_rodentlocation.history_rodentlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyRodentlocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Globalid column + Habitat column + Lastinspectaction column + Lastinspectconditions column + Lastinspectdate column + Lastinspectrodentevidence column + Lastinspectspecies column + Locationname column + Locationnumber column + Nextactiondatescheduled column + Objectid column + Priority column + Symbology column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Jurisdiction column + Version column +} + +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, + } +} + +type historyRodentlocationIndexes struct { + HistoryRodentlocationPkey index +} + +func (i historyRodentlocationIndexes) AsSlice() []index { + return []index{ + i.HistoryRodentlocationPkey, + } +} + +type historyRodentlocationForeignKeys struct { + HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey foreignKey +} + +func (f historyRodentlocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey, + } +} + +type historyRodentlocationUniques struct{} + +func (u historyRodentlocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyRodentlocationChecks struct{} + +func (c historyRodentlocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_samplecollection.bob.go b/dbinfo/history_samplecollection.bob.go new file mode 100644 index 00000000..fdbdda5b --- /dev/null +++ b/dbinfo/history_samplecollection.bob.go @@ -0,0 +1,602 @@ +// 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 HistorySamplecollections = Table[ + historySamplecollectionColumns, + historySamplecollectionIndexes, + historySamplecollectionForeignKeys, + historySamplecollectionUniques, + historySamplecollectionChecks, +]{ + Schema: "", + Name: "history_samplecollection", + Columns: historySamplecollectionColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Chickenid: column{ + Name: "chickenid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datesent: column{ + Name: "datesent", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetested: column{ + Name: "datetested", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasepos: column{ + Name: "diseasepos", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Diseasetested: column{ + Name: "diseasetested", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flockid: column{ + Name: "flockid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lab: column{ + Name: "lab", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LocID: column{ + Name: "loc_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplecond: column{ + Name: "samplecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplecount: column{ + Name: "samplecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampleid: column{ + Name: "sampleid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sampletype: column{ + Name: "sampletype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sex: column{ + Name: "sex", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Survtech: column{ + Name: "survtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testmethod: column{ + Name: "testmethod", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Testtech: column{ + Name: "testtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historySamplecollectionIndexes{ + HistorySamplecollectionPkey: index{ + Type: "btree", + Name: "history_samplecollection_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_samplecollection_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historySamplecollectionForeignKeys{ + HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_samplecollection.history_samplecollection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historySamplecollectionColumns struct { + OrganizationID column + Activity column + Avetemp column + Chickenid column + Comments column + Creationdate column + Creator column + Datesent column + Datetested column + Diseasepos column + Diseasetested column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Flockid column + Gatewaysync column + Globalid column + Lab column + Locationname column + LocID column + Objectid column + Processed column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Samplecond column + Samplecount column + Sampleid column + Sampletype column + Sex column + Sitecond column + Species column + Startdatetime column + Survtech column + Testmethod column + Testtech column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historySamplecollectionIndexes struct { + HistorySamplecollectionPkey index +} + +func (i historySamplecollectionIndexes) AsSlice() []index { + return []index{ + i.HistorySamplecollectionPkey, + } +} + +type historySamplecollectionForeignKeys struct { + HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey foreignKey +} + +func (f historySamplecollectionForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey, + } +} + +type historySamplecollectionUniques struct{} + +func (u historySamplecollectionUniques) AsSlice() []constraint { + return []constraint{} +} + +type historySamplecollectionChecks struct{} + +func (c historySamplecollectionChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_samplelocation.bob.go b/dbinfo/history_samplelocation.bob.go new file mode 100644 index 00000000..7509e5e7 --- /dev/null +++ b/dbinfo/history_samplelocation.bob.go @@ -0,0 +1,382 @@ +// 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 HistorySamplelocations = Table[ + historySamplelocationColumns, + historySamplelocationIndexes, + historySamplelocationForeignKeys, + historySamplelocationUniques, + historySamplelocationChecks, +]{ + Schema: "", + Name: "history_samplelocation", + Columns: historySamplelocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historySamplelocationIndexes{ + HistorySamplelocationPkey: index{ + Type: "btree", + Name: "history_samplelocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_samplelocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historySamplelocationForeignKeys{ + HistorySamplelocationHistorySamplelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_samplelocation.history_samplelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historySamplelocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Gatewaysync column + Globalid column + Habitat column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historySamplelocationIndexes struct { + HistorySamplelocationPkey index +} + +func (i historySamplelocationIndexes) AsSlice() []index { + return []index{ + i.HistorySamplelocationPkey, + } +} + +type historySamplelocationForeignKeys struct { + HistorySamplelocationHistorySamplelocationOrganizationIDFkey foreignKey +} + +func (f historySamplelocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistorySamplelocationHistorySamplelocationOrganizationIDFkey, + } +} + +type historySamplelocationUniques struct{} + +func (u historySamplelocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historySamplelocationChecks struct{} + +func (c historySamplelocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_servicerequest.bob.go b/dbinfo/history_servicerequest.bob.go new file mode 100644 index 00000000..e6b32c53 --- /dev/null +++ b/dbinfo/history_servicerequest.bob.go @@ -0,0 +1,1002 @@ +// 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 HistoryServicerequests = Table[ + historyServicerequestColumns, + historyServicerequestIndexes, + historyServicerequestForeignKeys, + historyServicerequestUniques, + historyServicerequestChecks, +]{ + Schema: "", + Name: "history_servicerequest", + Columns: historyServicerequestColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accepted: column{ + Name: "accepted", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Acceptedby: column{ + Name: "acceptedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accepteddate: column{ + Name: "accepteddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Allowed: column{ + Name: "allowed", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Assignedtech: column{ + Name: "assignedtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clraddr1: column{ + Name: "clraddr1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clraddr2: column{ + Name: "clraddr2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clranon: column{ + Name: "clranon", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcity: column{ + Name: "clrcity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcompany: column{ + Name: "clrcompany", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrcontpref: column{ + Name: "clrcontpref", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clremail: column{ + Name: "clremail", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrfname: column{ + Name: "clrfname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrother: column{ + Name: "clrother", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrphone1: column{ + Name: "clrphone1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrphone2: column{ + Name: "clrphone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrstate: column{ + Name: "clrstate", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Clrzip: column{ + Name: "clrzip", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Datetimeclosed: column{ + Name: "datetimeclosed", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Duedate: column{ + Name: "duedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Entrytech: column{ + Name: "entrytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Estcompletedate: column{ + Name: "estcompletedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalerror: column{ + Name: "externalerror", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Firstresponsedate: column{ + Name: "firstresponsedate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Issuesreported: column{ + Name: "issuesreported", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextaction: column{ + Name: "nextaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notificationtimestamp: column{ + Name: "notificationtimestamp", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notified: column{ + Name: "notified", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notifieddate: column{ + Name: "notifieddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recdatetime: column{ + Name: "recdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejectedby: column{ + Name: "rejectedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejecteddate: column{ + Name: "rejecteddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rejectedreason: column{ + Name: "rejectedreason", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqaddr1: column{ + Name: "reqaddr1", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqaddr2: column{ + Name: "reqaddr2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcity: column{ + Name: "reqcity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcompany: column{ + Name: "reqcompany", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqcrossst: column{ + Name: "reqcrossst", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqdescr: column{ + Name: "reqdescr", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqfldnotes: column{ + Name: "reqfldnotes", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqmapgrid: column{ + Name: "reqmapgrid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqnotesforcust: column{ + Name: "reqnotesforcust", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqnotesfortech: column{ + Name: "reqnotesfortech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqpermission: column{ + Name: "reqpermission", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqprogramactions: column{ + Name: "reqprogramactions", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqstate: column{ + Name: "reqstate", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqsubdiv: column{ + Name: "reqsubdiv", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqtarget: column{ + Name: "reqtarget", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reqzip: column{ + Name: "reqzip", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Responsedaycount: column{ + Name: "responsedaycount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scheduled: column{ + Name: "scheduled", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Scheduleddate: column{ + Name: "scheduleddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Source: column{ + Name: "source", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SRNumber: column{ + Name: "sr_number", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Status: column{ + Name: "status", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Supervisor: column{ + Name: "supervisor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Techclosed: column{ + Name: "techclosed", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Validx: column{ + Name: "validx", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Validy: column{ + Name: "validy", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Xvalue: column{ + Name: "xvalue", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Yvalue: column{ + Name: "yvalue", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Dog: column{ + Name: "dog", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Spanish: column{ + Name: "spanish", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ScheduleNotes: column{ + Name: "schedule_notes", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SchedulePeriod: column{ + Name: "schedule_period", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyServicerequestIndexes{ + HistoryServicerequestPkey: index{ + Type: "btree", + Name: "history_servicerequest_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_servicerequest_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyServicerequestForeignKeys{ + HistoryServicerequestHistoryServicerequestOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_servicerequest.history_servicerequest_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyServicerequestColumns struct { + OrganizationID column + Accepted column + Acceptedby column + Accepteddate column + Allowed column + Assignedtech column + Clraddr1 column + Clraddr2 column + Clranon column + Clrcity column + Clrcompany column + Clrcontpref column + Clremail column + Clrfname column + Clrother column + Clrphone1 column + Clrphone2 column + Clrstate column + Clrzip column + Comments column + Creationdate column + Creator column + Datetimeclosed column + Duedate column + Entrytech column + Estcompletedate column + Externalerror column + Externalid column + Editdate column + Editor column + Firstresponsedate column + Globalid column + Issuesreported column + Jurisdiction column + Nextaction column + Notificationtimestamp column + Notified column + Notifieddate column + Objectid column + Pointlocid column + Priority column + Recdatetime column + Recordstatus column + Rejectedby column + Rejecteddate column + Rejectedreason column + Reqaddr1 column + Reqaddr2 column + Reqcity column + Reqcompany column + Reqcrossst column + Reqdescr column + Reqfldnotes column + Reqmapgrid column + Reqnotesforcust column + Reqnotesfortech column + Reqpermission column + Reqprogramactions column + Reqstate column + Reqsubdiv column + Reqtarget column + Reqzip column + Responsedaycount column + Reviewed column + Reviewedby column + Revieweddate column + Scheduled column + Scheduleddate column + Source column + SRNumber column + Status column + Supervisor column + Techclosed column + Validx column + Validy column + Xvalue column + Yvalue column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Dog column + Spanish column + ScheduleNotes column + SchedulePeriod column + Version column +} + +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, + } +} + +type historyServicerequestIndexes struct { + HistoryServicerequestPkey index +} + +func (i historyServicerequestIndexes) AsSlice() []index { + return []index{ + i.HistoryServicerequestPkey, + } +} + +type historyServicerequestForeignKeys struct { + HistoryServicerequestHistoryServicerequestOrganizationIDFkey foreignKey +} + +func (f historyServicerequestForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryServicerequestHistoryServicerequestOrganizationIDFkey, + } +} + +type historyServicerequestUniques struct{} + +func (u historyServicerequestUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyServicerequestChecks struct{} + +func (c historyServicerequestChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_speciesabundance.bob.go b/dbinfo/history_speciesabundance.bob.go new file mode 100644 index 00000000..3c1e302f --- /dev/null +++ b/dbinfo/history_speciesabundance.bob.go @@ -0,0 +1,432 @@ +// 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 HistorySpeciesabundances = Table[ + historySpeciesabundanceColumns, + historySpeciesabundanceIndexes, + historySpeciesabundanceForeignKeys, + historySpeciesabundanceUniques, + historySpeciesabundanceChecks, +]{ + Schema: "", + Name: "history_speciesabundance", + Columns: historySpeciesabundanceColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Bloodedfem: column{ + Name: "bloodedfem", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Eggs: column{ + Name: "eggs", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Females: column{ + Name: "females", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gravidfem: column{ + Name: "gravidfem", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Larvae: column{ + Name: "larvae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Males: column{ + Name: "males", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Poolstogen: column{ + Name: "poolstogen", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Pupae: column{ + Name: "pupae", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Species: column{ + Name: "species", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Total: column{ + Name: "total", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TrapdataID: column{ + Name: "trapdata_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Unknown: column{ + Name: "unknown", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalzscore: column{ + Name: "globalzscore", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R7: column{ + Name: "h3r7", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R8: column{ + Name: "h3r8", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + R7score: column{ + Name: "r7score", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + R8score: column{ + Name: "r8score", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Yearweek: column{ + Name: "yearweek", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historySpeciesabundanceIndexes{ + HistorySpeciesabundancePkey: index{ + Type: "btree", + Name: "history_speciesabundance_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_speciesabundance_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historySpeciesabundanceForeignKeys{ + HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_speciesabundance.history_speciesabundance_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historySpeciesabundanceColumns struct { + OrganizationID column + Bloodedfem column + Creationdate column + Creator column + Eggs column + Editdate column + Editor column + Females column + Gravidfem column + Globalid column + Larvae column + Males column + Objectid column + Poolstogen column + Processed column + Pupae column + Species column + Total column + TrapdataID column + Unknown column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Globalzscore column + H3R7 column + H3R8 column + R7score column + R8score column + Yearweek column + Version column +} + +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, + } +} + +type historySpeciesabundanceIndexes struct { + HistorySpeciesabundancePkey index +} + +func (i historySpeciesabundanceIndexes) AsSlice() []index { + return []index{ + i.HistorySpeciesabundancePkey, + } +} + +type historySpeciesabundanceForeignKeys struct { + HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey foreignKey +} + +func (f historySpeciesabundanceForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey, + } +} + +type historySpeciesabundanceUniques struct{} + +func (u historySpeciesabundanceUniques) AsSlice() []constraint { + return []constraint{} +} + +type historySpeciesabundanceChecks struct{} + +func (c historySpeciesabundanceChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_stormdrain.bob.go b/dbinfo/history_stormdrain.bob.go new file mode 100644 index 00000000..e3daae69 --- /dev/null +++ b/dbinfo/history_stormdrain.bob.go @@ -0,0 +1,332 @@ +// 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 HistoryStormdrains = Table[ + historyStormdrainColumns, + historyStormdrainIndexes, + historyStormdrainForeignKeys, + historyStormdrainUniques, + historyStormdrainChecks, +]{ + Schema: "", + Name: "history_stormdrain", + Columns: historyStormdrainColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Jurisdiction: column{ + Name: "jurisdiction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lastaction: column{ + Name: "lastaction", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Laststatus: column{ + Name: "laststatus", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lasttreatdate: column{ + Name: "lasttreatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nexttreatmentdate: column{ + Name: "nexttreatmentdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Symbology: column{ + Name: "symbology", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyStormdrainIndexes{ + HistoryStormdrainPkey: index{ + Type: "btree", + Name: "history_stormdrain_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_stormdrain_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyStormdrainForeignKeys{ + HistoryStormdrainHistoryStormdrainOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_stormdrain.history_stormdrain_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyStormdrainColumns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Jurisdiction column + Lastaction column + Laststatus column + Lasttreatdate column + Nexttreatmentdate column + Objectid column + Symbology column + Type column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyStormdrainIndexes struct { + HistoryStormdrainPkey index +} + +func (i historyStormdrainIndexes) AsSlice() []index { + return []index{ + i.HistoryStormdrainPkey, + } +} + +type historyStormdrainForeignKeys struct { + HistoryStormdrainHistoryStormdrainOrganizationIDFkey foreignKey +} + +func (f historyStormdrainForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryStormdrainHistoryStormdrainOrganizationIDFkey, + } +} + +type historyStormdrainUniques struct{} + +func (u historyStormdrainUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyStormdrainChecks struct{} + +func (c historyStormdrainChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_timecard.bob.go b/dbinfo/history_timecard.bob.go new file mode 100644 index 00000000..7758bf48 --- /dev/null +++ b/dbinfo/history_timecard.bob.go @@ -0,0 +1,422 @@ +// 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 HistoryTimecards = Table[ + historyTimecardColumns, + historyTimecardIndexes, + historyTimecardForeignKeys, + historyTimecardUniques, + historyTimecardChecks, +]{ + Schema: "", + Name: "history_timecard", + Columns: historyTimecardColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Equiptype: column{ + Name: "equiptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lclocid: column{ + Name: "lclocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Samplelocid: column{ + Name: "samplelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Traplocid: column{ + Name: "traplocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Rodentlocid: column{ + Name: "rodentlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyTimecardIndexes{ + HistoryTimecardPkey: index{ + Type: "btree", + Name: "history_timecard_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_timecard_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyTimecardForeignKeys{ + HistoryTimecardHistoryTimecardOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_timecard.history_timecard_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyTimecardColumns struct { + OrganizationID column + Activity column + Comments column + Creationdate column + Creator column + Enddatetime column + Equiptype column + Externalid column + Editdate column + Editor column + Fieldtech column + Globalid column + Lclocid column + Linelocid column + Locationname column + Objectid column + Pointlocid column + Polygonlocid column + Samplelocid column + Srid column + Startdatetime column + Traplocid column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Rodentlocid column + Version column +} + +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, + } +} + +type historyTimecardIndexes struct { + HistoryTimecardPkey index +} + +func (i historyTimecardIndexes) AsSlice() []index { + return []index{ + i.HistoryTimecardPkey, + } +} + +type historyTimecardForeignKeys struct { + HistoryTimecardHistoryTimecardOrganizationIDFkey foreignKey +} + +func (f historyTimecardForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryTimecardHistoryTimecardOrganizationIDFkey, + } +} + +type historyTimecardUniques struct{} + +func (u historyTimecardUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyTimecardChecks struct{} + +func (c historyTimecardChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_trapdata.bob.go b/dbinfo/history_trapdata.bob.go new file mode 100644 index 00000000..47cdf577 --- /dev/null +++ b/dbinfo/history_trapdata.bob.go @@ -0,0 +1,562 @@ +// 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 HistoryTrapdata = Table[ + historyTrapdatumColumns, + historyTrapdatumIndexes, + historyTrapdatumForeignKeys, + historyTrapdatumUniques, + historyTrapdatumChecks, +]{ + Schema: "", + Name: "history_trapdata", + Columns: historyTrapdatumColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Field: column{ + Name: "field", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Idbytech: column{ + Name: "idbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LocID: column{ + Name: "loc_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LR: column{ + Name: "lr", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Processed: column{ + Name: "processed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sortbytech: column{ + Name: "sortbytech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapactivitytype: column{ + Name: "trapactivitytype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapcondition: column{ + Name: "trapcondition", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Trapnights: column{ + Name: "trapnights", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Traptype: column{ + Name: "traptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Voltage: column{ + Name: "voltage", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Lure: column{ + Name: "lure", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtrapdataid: column{ + Name: "vectorsurvtrapdataid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvtraplocationid: column{ + Name: "vectorsurvtraplocationid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyTrapdatumIndexes{ + HistoryTrapdataPkey: index{ + Type: "btree", + Name: "history_trapdata_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_trapdata_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyTrapdatumForeignKeys{ + HistoryTrapdataHistoryTrapdataOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_trapdata.history_trapdata_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyTrapdatumColumns struct { + OrganizationID column + Avetemp column + Comments column + Creationdate column + Creator column + Enddatetime column + Editdate column + Editor column + Fieldtech column + Field column + Gatewaysync column + Globalid column + Idbytech column + Locationname column + LocID column + LR column + Objectid column + Processed column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sitecond column + Sortbytech column + Srid column + Startdatetime column + Trapactivitytype column + Trapcondition column + Trapnights column + Traptype column + Voltage column + Winddir column + Windspeed column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Lure column + Vectorsurvtrapdataid column + Vectorsurvtraplocationid column + Version column +} + +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, + } +} + +type historyTrapdatumIndexes struct { + HistoryTrapdataPkey index +} + +func (i historyTrapdatumIndexes) AsSlice() []index { + return []index{ + i.HistoryTrapdataPkey, + } +} + +type historyTrapdatumForeignKeys struct { + HistoryTrapdataHistoryTrapdataOrganizationIDFkey foreignKey +} + +func (f historyTrapdatumForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryTrapdataHistoryTrapdataOrganizationIDFkey, + } +} + +type historyTrapdatumUniques struct{} + +func (u historyTrapdatumUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyTrapdatumChecks struct{} + +func (c historyTrapdatumChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_traplocation.bob.go b/dbinfo/history_traplocation.bob.go new file mode 100644 index 00000000..28e6f061 --- /dev/null +++ b/dbinfo/history_traplocation.bob.go @@ -0,0 +1,442 @@ +// 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 HistoryTraplocations = Table[ + historyTraplocationColumns, + historyTraplocationIndexes, + historyTraplocationForeignKeys, + historyTraplocationUniques, + historyTraplocationChecks, +]{ + Schema: "", + Name: "history_traplocation", + Columns: historyTraplocationColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Accessdesc: column{ + Name: "accessdesc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Description: column{ + Name: "description", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Externalid: column{ + Name: "externalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Gatewaysync: column{ + Name: "gatewaysync", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationnumber: column{ + Name: "locationnumber", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Nextactiondatescheduled: column{ + Name: "nextactiondatescheduled", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Priority: column{ + Name: "priority", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Usetype: column{ + Name: "usetype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Route: column{ + Name: "route", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RouteOrder: column{ + Name: "route_order", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SetDow: column{ + Name: "set_dow", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Vectorsurvsiteid: column{ + Name: "vectorsurvsiteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R7: column{ + Name: "h3r7", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + H3R8: column{ + Name: "h3r8", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyTraplocationIndexes{ + HistoryTraplocationPkey: index{ + Type: "btree", + Name: "history_traplocation_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_traplocation_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyTraplocationForeignKeys{ + HistoryTraplocationHistoryTraplocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_traplocation.history_traplocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyTraplocationColumns struct { + OrganizationID column + Accessdesc column + Active column + Comments column + Creationdate column + Creator column + Description column + Externalid column + Editdate column + Editor column + Gatewaysync column + Globalid column + Habitat column + Locationnumber column + Name column + Nextactiondatescheduled column + Objectid column + Priority column + Usetype column + Zone column + Zone2 column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Route column + RouteOrder column + SetDow column + Vectorsurvsiteid column + H3R7 column + H3R8 column + Version column +} + +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, + } +} + +type historyTraplocationIndexes struct { + HistoryTraplocationPkey index +} + +func (i historyTraplocationIndexes) AsSlice() []index { + return []index{ + i.HistoryTraplocationPkey, + } +} + +type historyTraplocationForeignKeys struct { + HistoryTraplocationHistoryTraplocationOrganizationIDFkey foreignKey +} + +func (f historyTraplocationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryTraplocationHistoryTraplocationOrganizationIDFkey, + } +} + +type historyTraplocationUniques struct{} + +func (u historyTraplocationUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyTraplocationChecks struct{} + +func (c historyTraplocationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_treatment.bob.go b/dbinfo/history_treatment.bob.go new file mode 100644 index 00000000..8e8d9a07 --- /dev/null +++ b/dbinfo/history_treatment.bob.go @@ -0,0 +1,682 @@ +// 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 HistoryTreatments = Table[ + historyTreatmentColumns, + historyTreatmentIndexes, + historyTreatmentForeignKeys, + historyTreatmentUniques, + historyTreatmentChecks, +]{ + Schema: "", + Name: "history_treatment", + Columns: historyTreatmentColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Activity: column{ + Name: "activity", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Areaunit: column{ + Name: "areaunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Avetemp: column{ + Name: "avetemp", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Barrierrouteid: column{ + Name: "barrierrouteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Cbcount: column{ + Name: "cbcount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Containercount: column{ + Name: "containercount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Enddatetime: column{ + Name: "enddatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Equiptype: column{ + Name: "equiptype", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Fieldtech: column{ + Name: "fieldtech", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Flowrate: column{ + Name: "flowrate", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Habitat: column{ + Name: "habitat", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + InspID: column{ + Name: "insp_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Invloc: column{ + Name: "invloc", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Linelocid: column{ + Name: "linelocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Locationname: column{ + Name: "locationname", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Method: column{ + Name: "method", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Pointlocid: column{ + Name: "pointlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Polygonlocid: column{ + Name: "polygonlocid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Product: column{ + Name: "product", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ptaid: column{ + Name: "ptaid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Qty: column{ + Name: "qty", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Qtyunit: column{ + Name: "qtyunit", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Raingauge: column{ + Name: "raingauge", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Recordstatus: column{ + Name: "recordstatus", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Reviewedby: column{ + Name: "reviewedby", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Revieweddate: column{ + Name: "revieweddate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sdid: column{ + Name: "sdid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Sitecond: column{ + Name: "sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Startdatetime: column{ + Name: "startdatetime", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Targetspecies: column{ + Name: "targetspecies", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Tirecount: column{ + Name: "tirecount", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatacres: column{ + Name: "treatacres", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatarea: column{ + Name: "treatarea", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treathectares: column{ + Name: "treathectares", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmenthours: column{ + Name: "treatmenthours", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmentlength: column{ + Name: "treatmentlength", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatmentlengthunits: column{ + Name: "treatmentlengthunits", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Totalcostprodcut: column{ + Name: "totalcostprodcut", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Ulvrouteid: column{ + Name: "ulvrouteid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Warningoverride: column{ + Name: "warningoverride", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Winddir: column{ + Name: "winddir", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Windspeed: column{ + Name: "windspeed", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone: column{ + Name: "zone", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Zone2: column{ + Name: "zone2", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TempSitecond: column{ + Name: "temp_sitecond", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyTreatmentIndexes{ + HistoryTreatmentPkey: index{ + Type: "btree", + Name: "history_treatment_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_treatment_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyTreatmentForeignKeys{ + HistoryTreatmentHistoryTreatmentOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_treatment.history_treatment_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyTreatmentColumns struct { + OrganizationID column + Activity column + Areaunit column + Avetemp column + Barrierrouteid column + Cbcount column + Comments column + Containercount column + Creationdate column + Creator column + Enddatetime column + Equiptype column + Editdate column + Editor column + Fieldtech column + Flowrate column + Globalid column + Habitat column + InspID column + Invloc column + Linelocid column + Locationname column + Method column + Objectid column + Pointlocid column + Polygonlocid column + Product column + Ptaid column + Qty column + Qtyunit column + Raingauge column + Recordstatus column + Reviewed column + Reviewedby column + Revieweddate column + Sdid column + Sitecond column + Srid column + Startdatetime column + Targetspecies column + Tirecount column + Treatacres column + Treatarea column + Treathectares column + Treatmenthours column + Treatmentlength column + Treatmentlengthunits column + Totalcostprodcut column + Ulvrouteid column + Warningoverride column + Winddir column + Windspeed column + Zone column + Zone2 column + GeometryX column + GeometryY column + TempSitecond column + Version column +} + +func (c historyTreatmentColumns) AsSlice() []column { + return []column{ + c.OrganizationID, c.Activity, c.Areaunit, c.Avetemp, c.Barrierrouteid, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Editdate, c.Editor, c.Fieldtech, c.Flowrate, c.Globalid, c.Habitat, c.InspID, c.Invloc, c.Linelocid, c.Locationname, c.Method, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Product, c.Ptaid, c.Qty, c.Qtyunit, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Targetspecies, c.Tirecount, c.Treatacres, c.Treatarea, c.Treathectares, c.Treatmenthours, c.Treatmentlength, c.Treatmentlengthunits, c.Totalcostprodcut, c.Ulvrouteid, c.Warningoverride, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.TempSitecond, c.Version, + } +} + +type historyTreatmentIndexes struct { + HistoryTreatmentPkey index +} + +func (i historyTreatmentIndexes) AsSlice() []index { + return []index{ + i.HistoryTreatmentPkey, + } +} + +type historyTreatmentForeignKeys struct { + HistoryTreatmentHistoryTreatmentOrganizationIDFkey foreignKey +} + +func (f historyTreatmentForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryTreatmentHistoryTreatmentOrganizationIDFkey, + } +} + +type historyTreatmentUniques struct{} + +func (u historyTreatmentUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyTreatmentChecks struct{} + +func (c historyTreatmentChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_treatmentarea.bob.go b/dbinfo/history_treatmentarea.bob.go new file mode 100644 index 00000000..85adf81a --- /dev/null +++ b/dbinfo/history_treatmentarea.bob.go @@ -0,0 +1,322 @@ +// 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 HistoryTreatmentareas = Table[ + historyTreatmentareaColumns, + historyTreatmentareaIndexes, + historyTreatmentareaForeignKeys, + historyTreatmentareaUniques, + historyTreatmentareaChecks, +]{ + Schema: "", + Name: "history_treatmentarea", + Columns: historyTreatmentareaColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Comments: column{ + Name: "comments", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Notified: column{ + Name: "notified", + DBType: "smallint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + SessionID: column{ + Name: "session_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Treatdate: column{ + Name: "treatdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TreatID: column{ + Name: "treat_id", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyTreatmentareaIndexes{ + HistoryTreatmentareaPkey: index{ + Type: "btree", + Name: "history_treatmentarea_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_treatmentarea_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyTreatmentareaForeignKeys{ + HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_treatmentarea.history_treatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyTreatmentareaColumns struct { + OrganizationID column + Comments column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Notified column + Objectid column + SessionID column + ShapeArea column + ShapeLength column + Treatdate column + TreatID column + Type column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyTreatmentareaIndexes struct { + HistoryTreatmentareaPkey index +} + +func (i historyTreatmentareaIndexes) AsSlice() []index { + return []index{ + i.HistoryTreatmentareaPkey, + } +} + +type historyTreatmentareaForeignKeys struct { + HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey foreignKey +} + +func (f historyTreatmentareaForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey, + } +} + +type historyTreatmentareaUniques struct{} + +func (u historyTreatmentareaUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyTreatmentareaChecks struct{} + +func (c historyTreatmentareaChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_zones.bob.go b/dbinfo/history_zones.bob.go new file mode 100644 index 00000000..be4645d4 --- /dev/null +++ b/dbinfo/history_zones.bob.go @@ -0,0 +1,282 @@ +// 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 HistoryZones = Table[ + historyZoneColumns, + historyZoneIndexes, + historyZoneForeignKeys, + historyZoneUniques, + historyZoneChecks, +]{ + Schema: "", + Name: "history_zones", + Columns: historyZoneColumns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Active: column{ + Name: "active", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyZoneIndexes{ + HistoryZonesPkey: index{ + Type: "btree", + Name: "history_zones_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_zones_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyZoneForeignKeys{ + HistoryZonesHistoryZonesOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_zones.history_zones_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyZoneColumns struct { + OrganizationID column + Active column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Name column + Objectid column + ShapeArea column + ShapeLength column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyZoneIndexes struct { + HistoryZonesPkey index +} + +func (i historyZoneIndexes) AsSlice() []index { + return []index{ + i.HistoryZonesPkey, + } +} + +type historyZoneForeignKeys struct { + HistoryZonesHistoryZonesOrganizationIDFkey foreignKey +} + +func (f historyZoneForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryZonesHistoryZonesOrganizationIDFkey, + } +} + +type historyZoneUniques struct{} + +func (u historyZoneUniques) AsSlice() []constraint { + return []constraint{} +} + +type historyZoneChecks struct{} + +func (c historyZoneChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/history_zones2.bob.go b/dbinfo/history_zones2.bob.go new file mode 100644 index 00000000..6bc11e39 --- /dev/null +++ b/dbinfo/history_zones2.bob.go @@ -0,0 +1,272 @@ +// 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 HistoryZones2s = Table[ + historyZones2Columns, + historyZones2Indexes, + historyZones2ForeignKeys, + historyZones2Uniques, + historyZones2Checks, +]{ + Schema: "", + Name: "history_zones2", + Columns: historyZones2Columns{ + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creationdate: column{ + Name: "creationdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Creator: column{ + Name: "creator", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editdate: column{ + Name: "editdate", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Editor: column{ + Name: "editor", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Globalid: column{ + Name: "globalid", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Name: column{ + Name: "name", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Objectid: column{ + Name: "objectid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ShapeArea: column{ + Name: "shape__area", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ShapeLength: column{ + Name: "shape__length", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedDate: column{ + Name: "created_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CreatedUser: column{ + Name: "created_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryX: column{ + Name: "geometry_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + GeometryY: column{ + Name: "geometry_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedDate: column{ + Name: "last_edited_date", + DBType: "bigint", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + LastEditedUser: column{ + Name: "last_edited_user", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: historyZones2Indexes{ + HistoryZones2Pkey: index{ + Type: "btree", + Name: "history_zones2_pkey", + Columns: []indexColumn{ + { + Name: "objectid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "history_zones2_pkey", + Columns: []string{"objectid", "version"}, + Comment: "", + }, + ForeignKeys: historyZones2ForeignKeys{ + HistoryZones2HistoryZones2OrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "history_zones2.history_zones2_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type historyZones2Columns struct { + OrganizationID column + Creationdate column + Creator column + Editdate column + Editor column + Globalid column + Name column + Objectid column + ShapeArea column + ShapeLength column + CreatedDate column + CreatedUser column + GeometryX column + GeometryY column + LastEditedDate column + LastEditedUser column + Version column +} + +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, + } +} + +type historyZones2Indexes struct { + HistoryZones2Pkey index +} + +func (i historyZones2Indexes) AsSlice() []index { + return []index{ + i.HistoryZones2Pkey, + } +} + +type historyZones2ForeignKeys struct { + HistoryZones2HistoryZones2OrganizationIDFkey foreignKey +} + +func (f historyZones2ForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.HistoryZones2HistoryZones2OrganizationIDFkey, + } +} + +type historyZones2Uniques struct{} + +func (u historyZones2Uniques) AsSlice() []constraint { + return []constraint{} +} + +type historyZones2Checks struct{} + +func (c historyZones2Checks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/organization.bob.go b/dbinfo/organization.bob.go index b278235a..15a8522a 100644 --- a/dbinfo/organization.bob.go +++ b/dbinfo/organization.bob.go @@ -51,6 +51,15 @@ var Organizations = Table[ Generated: false, AutoIncr: false, }, + FieldseekerURL: column{ + Name: "fieldseeker_url", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, }, Indexes: organizationIndexes{ OrganizationPkey: index{ @@ -81,15 +90,16 @@ var Organizations = Table[ } type organizationColumns struct { - ID column - Name column - ArcgisID column - ArcgisName column + ID column + Name column + ArcgisID column + ArcgisName column + FieldseekerURL column } func (c organizationColumns) AsSlice() []column { return []column{ - c.ID, c.Name, c.ArcgisID, c.ArcgisName, + c.ID, c.Name, c.ArcgisID, c.ArcgisName, c.FieldseekerURL, } } diff --git a/factory/bobfactory_context.bob.go b/factory/bobfactory_context.bob.go index a9176222..4787aaab 100644 --- a/factory/bobfactory_context.bob.go +++ b/factory/bobfactory_context.bob.go @@ -8,16 +8,286 @@ import "context" type contextKey string var ( + // Relationship Contexts for fs_containerrelate + fsContainerrelateWithParentsCascadingCtx = newContextual[bool]("fsContainerrelateWithParentsCascading") + fsContainerrelateRelOrganizationCtx = newContextual[bool]("fs_containerrelate.organization.fs_containerrelate.fs_containerrelate_organization_id_fkey") + + // Relationship Contexts for fs_fieldscoutinglog + fsFieldscoutinglogWithParentsCascadingCtx = newContextual[bool]("fsFieldscoutinglogWithParentsCascading") + fsFieldscoutinglogRelOrganizationCtx = newContextual[bool]("fs_fieldscoutinglog.organization.fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey") + + // Relationship Contexts for fs_habitatrelate + fsHabitatrelateWithParentsCascadingCtx = newContextual[bool]("fsHabitatrelateWithParentsCascading") + fsHabitatrelateRelOrganizationCtx = newContextual[bool]("fs_habitatrelate.organization.fs_habitatrelate.fs_habitatrelate_organization_id_fkey") + + // Relationship Contexts for fs_inspectionsample + fsInspectionsampleWithParentsCascadingCtx = newContextual[bool]("fsInspectionsampleWithParentsCascading") + fsInspectionsampleRelOrganizationCtx = newContextual[bool]("fs_inspectionsample.organization.fs_inspectionsample.fs_inspectionsample_organization_id_fkey") + + // Relationship Contexts for fs_inspectionsampledetail + fsInspectionsampledetailWithParentsCascadingCtx = newContextual[bool]("fsInspectionsampledetailWithParentsCascading") + fsInspectionsampledetailRelOrganizationCtx = newContextual[bool]("fs_inspectionsampledetail.organization.fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey") + + // Relationship Contexts for fs_linelocation + fsLinelocationWithParentsCascadingCtx = newContextual[bool]("fsLinelocationWithParentsCascading") + fsLinelocationRelOrganizationCtx = newContextual[bool]("fs_linelocation.organization.fs_linelocation.fs_linelocation_organization_id_fkey") + + // Relationship Contexts for fs_locationtracking + fsLocationtrackingWithParentsCascadingCtx = newContextual[bool]("fsLocationtrackingWithParentsCascading") + fsLocationtrackingRelOrganizationCtx = newContextual[bool]("fs_locationtracking.organization.fs_locationtracking.fs_locationtracking_organization_id_fkey") + + // Relationship Contexts for fs_mosquitoinspection + fsMosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("fsMosquitoinspectionWithParentsCascading") + fsMosquitoinspectionRelOrganizationCtx = newContextual[bool]("fs_mosquitoinspection.organization.fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey") + + // Relationship Contexts for fs_pointlocation + fsPointlocationWithParentsCascadingCtx = newContextual[bool]("fsPointlocationWithParentsCascading") + fsPointlocationRelOrganizationCtx = newContextual[bool]("fs_pointlocation.organization.fs_pointlocation.fs_pointlocation_organization_id_fkey") + + // Relationship Contexts for fs_polygonlocation + fsPolygonlocationWithParentsCascadingCtx = newContextual[bool]("fsPolygonlocationWithParentsCascading") + fsPolygonlocationRelOrganizationCtx = newContextual[bool]("fs_polygonlocation.organization.fs_polygonlocation.fs_polygonlocation_organization_id_fkey") + + // Relationship Contexts for fs_pool + fsPoolWithParentsCascadingCtx = newContextual[bool]("fsPoolWithParentsCascading") + fsPoolRelOrganizationCtx = newContextual[bool]("fs_pool.organization.fs_pool.fs_pool_organization_id_fkey") + + // Relationship Contexts for fs_pooldetail + fsPooldetailWithParentsCascadingCtx = newContextual[bool]("fsPooldetailWithParentsCascading") + fsPooldetailRelOrganizationCtx = newContextual[bool]("fs_pooldetail.organization.fs_pooldetail.fs_pooldetail_organization_id_fkey") + + // Relationship Contexts for fs_proposedtreatmentarea + fsProposedtreatmentareaWithParentsCascadingCtx = newContextual[bool]("fsProposedtreatmentareaWithParentsCascading") + fsProposedtreatmentareaRelOrganizationCtx = newContextual[bool]("fs_proposedtreatmentarea.organization.fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey") + + // Relationship Contexts for fs_qamosquitoinspection + fsQamosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("fsQamosquitoinspectionWithParentsCascading") + fsQamosquitoinspectionRelOrganizationCtx = newContextual[bool]("fs_qamosquitoinspection.organization.fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey") + + // Relationship Contexts for fs_rodentlocation + fsRodentlocationWithParentsCascadingCtx = newContextual[bool]("fsRodentlocationWithParentsCascading") + fsRodentlocationRelOrganizationCtx = newContextual[bool]("fs_rodentlocation.organization.fs_rodentlocation.fs_rodentlocation_organization_id_fkey") + + // Relationship Contexts for fs_samplecollection + fsSamplecollectionWithParentsCascadingCtx = newContextual[bool]("fsSamplecollectionWithParentsCascading") + fsSamplecollectionRelOrganizationCtx = newContextual[bool]("fs_samplecollection.organization.fs_samplecollection.fs_samplecollection_organization_id_fkey") + + // Relationship Contexts for fs_samplelocation + fsSamplelocationWithParentsCascadingCtx = newContextual[bool]("fsSamplelocationWithParentsCascading") + fsSamplelocationRelOrganizationCtx = newContextual[bool]("fs_samplelocation.organization.fs_samplelocation.fs_samplelocation_organization_id_fkey") + + // Relationship Contexts for fs_servicerequest + fsServicerequestWithParentsCascadingCtx = newContextual[bool]("fsServicerequestWithParentsCascading") + fsServicerequestRelOrganizationCtx = newContextual[bool]("fs_servicerequest.organization.fs_servicerequest.fs_servicerequest_organization_id_fkey") + + // Relationship Contexts for fs_speciesabundance + fsSpeciesabundanceWithParentsCascadingCtx = newContextual[bool]("fsSpeciesabundanceWithParentsCascading") + fsSpeciesabundanceRelOrganizationCtx = newContextual[bool]("fs_speciesabundance.organization.fs_speciesabundance.fs_speciesabundance_organization_id_fkey") + + // Relationship Contexts for fs_stormdrain + fsStormdrainWithParentsCascadingCtx = newContextual[bool]("fsStormdrainWithParentsCascading") + fsStormdrainRelOrganizationCtx = newContextual[bool]("fs_stormdrain.organization.fs_stormdrain.fs_stormdrain_organization_id_fkey") + + // Relationship Contexts for fs_timecard + fsTimecardWithParentsCascadingCtx = newContextual[bool]("fsTimecardWithParentsCascading") + fsTimecardRelOrganizationCtx = newContextual[bool]("fs_timecard.organization.fs_timecard.fs_timecard_organization_id_fkey") + + // Relationship Contexts for fs_trapdata + fsTrapdatumWithParentsCascadingCtx = newContextual[bool]("fsTrapdatumWithParentsCascading") + fsTrapdatumRelOrganizationCtx = newContextual[bool]("fs_trapdata.organization.fs_trapdata.fs_trapdata_organization_id_fkey") + + // Relationship Contexts for fs_traplocation + fsTraplocationWithParentsCascadingCtx = newContextual[bool]("fsTraplocationWithParentsCascading") + fsTraplocationRelOrganizationCtx = newContextual[bool]("fs_traplocation.organization.fs_traplocation.fs_traplocation_organization_id_fkey") + + // Relationship Contexts for fs_treatment + fsTreatmentWithParentsCascadingCtx = newContextual[bool]("fsTreatmentWithParentsCascading") + fsTreatmentRelOrganizationCtx = newContextual[bool]("fs_treatment.organization.fs_treatment.fs_treatment_organization_id_fkey") + + // Relationship Contexts for fs_treatmentarea + fsTreatmentareaWithParentsCascadingCtx = newContextual[bool]("fsTreatmentareaWithParentsCascading") + fsTreatmentareaRelOrganizationCtx = newContextual[bool]("fs_treatmentarea.organization.fs_treatmentarea.fs_treatmentarea_organization_id_fkey") + + // Relationship Contexts for fs_zones + fsZoneWithParentsCascadingCtx = newContextual[bool]("fsZoneWithParentsCascading") + fsZoneRelOrganizationCtx = newContextual[bool]("fs_zones.organization.fs_zones.fs_zones_organization_id_fkey") + + // Relationship Contexts for fs_zones2 + fsZones2WithParentsCascadingCtx = newContextual[bool]("fsZones2WithParentsCascading") + fsZones2RelOrganizationCtx = newContextual[bool]("fs_zones2.organization.fs_zones2.fs_zones2_organization_id_fkey") + // Relationship Contexts for goose_db_version gooseDBVersionWithParentsCascadingCtx = newContextual[bool]("gooseDBVersionWithParentsCascading") + // Relationship Contexts for history_containerrelate + historyContainerrelateWithParentsCascadingCtx = newContextual[bool]("historyContainerrelateWithParentsCascading") + historyContainerrelateRelOrganizationCtx = newContextual[bool]("history_containerrelate.organization.history_containerrelate.history_containerrelate_organization_id_fkey") + + // Relationship Contexts for history_fieldscoutinglog + historyFieldscoutinglogWithParentsCascadingCtx = newContextual[bool]("historyFieldscoutinglogWithParentsCascading") + historyFieldscoutinglogRelOrganizationCtx = newContextual[bool]("history_fieldscoutinglog.organization.history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey") + + // Relationship Contexts for history_habitatrelate + historyHabitatrelateWithParentsCascadingCtx = newContextual[bool]("historyHabitatrelateWithParentsCascading") + historyHabitatrelateRelOrganizationCtx = newContextual[bool]("history_habitatrelate.organization.history_habitatrelate.history_habitatrelate_organization_id_fkey") + + // Relationship Contexts for history_inspectionsample + historyInspectionsampleWithParentsCascadingCtx = newContextual[bool]("historyInspectionsampleWithParentsCascading") + historyInspectionsampleRelOrganizationCtx = newContextual[bool]("history_inspectionsample.organization.history_inspectionsample.history_inspectionsample_organization_id_fkey") + + // Relationship Contexts for history_inspectionsampledetail + historyInspectionsampledetailWithParentsCascadingCtx = newContextual[bool]("historyInspectionsampledetailWithParentsCascading") + historyInspectionsampledetailRelOrganizationCtx = newContextual[bool]("history_inspectionsampledetail.organization.history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey") + + // Relationship Contexts for history_linelocation + historyLinelocationWithParentsCascadingCtx = newContextual[bool]("historyLinelocationWithParentsCascading") + historyLinelocationRelOrganizationCtx = newContextual[bool]("history_linelocation.organization.history_linelocation.history_linelocation_organization_id_fkey") + + // Relationship Contexts for history_locationtracking + historyLocationtrackingWithParentsCascadingCtx = newContextual[bool]("historyLocationtrackingWithParentsCascading") + historyLocationtrackingRelOrganizationCtx = newContextual[bool]("history_locationtracking.organization.history_locationtracking.history_locationtracking_organization_id_fkey") + + // Relationship Contexts for history_mosquitoinspection + historyMosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("historyMosquitoinspectionWithParentsCascading") + historyMosquitoinspectionRelOrganizationCtx = newContextual[bool]("history_mosquitoinspection.organization.history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey") + + // Relationship Contexts for history_pointlocation + historyPointlocationWithParentsCascadingCtx = newContextual[bool]("historyPointlocationWithParentsCascading") + historyPointlocationRelOrganizationCtx = newContextual[bool]("history_pointlocation.organization.history_pointlocation.history_pointlocation_organization_id_fkey") + + // Relationship Contexts for history_polygonlocation + historyPolygonlocationWithParentsCascadingCtx = newContextual[bool]("historyPolygonlocationWithParentsCascading") + historyPolygonlocationRelOrganizationCtx = newContextual[bool]("history_polygonlocation.organization.history_polygonlocation.history_polygonlocation_organization_id_fkey") + + // Relationship Contexts for history_pool + historyPoolWithParentsCascadingCtx = newContextual[bool]("historyPoolWithParentsCascading") + historyPoolRelOrganizationCtx = newContextual[bool]("history_pool.organization.history_pool.history_pool_organization_id_fkey") + + // Relationship Contexts for history_pooldetail + historyPooldetailWithParentsCascadingCtx = newContextual[bool]("historyPooldetailWithParentsCascading") + historyPooldetailRelOrganizationCtx = newContextual[bool]("history_pooldetail.organization.history_pooldetail.history_pooldetail_organization_id_fkey") + + // Relationship Contexts for history_proposedtreatmentarea + historyProposedtreatmentareaWithParentsCascadingCtx = newContextual[bool]("historyProposedtreatmentareaWithParentsCascading") + historyProposedtreatmentareaRelOrganizationCtx = newContextual[bool]("history_proposedtreatmentarea.organization.history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey") + + // Relationship Contexts for history_qamosquitoinspection + historyQamosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("historyQamosquitoinspectionWithParentsCascading") + historyQamosquitoinspectionRelOrganizationCtx = newContextual[bool]("history_qamosquitoinspection.organization.history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey") + + // Relationship Contexts for history_rodentlocation + historyRodentlocationWithParentsCascadingCtx = newContextual[bool]("historyRodentlocationWithParentsCascading") + historyRodentlocationRelOrganizationCtx = newContextual[bool]("history_rodentlocation.organization.history_rodentlocation.history_rodentlocation_organization_id_fkey") + + // Relationship Contexts for history_samplecollection + historySamplecollectionWithParentsCascadingCtx = newContextual[bool]("historySamplecollectionWithParentsCascading") + historySamplecollectionRelOrganizationCtx = newContextual[bool]("history_samplecollection.organization.history_samplecollection.history_samplecollection_organization_id_fkey") + + // Relationship Contexts for history_samplelocation + historySamplelocationWithParentsCascadingCtx = newContextual[bool]("historySamplelocationWithParentsCascading") + historySamplelocationRelOrganizationCtx = newContextual[bool]("history_samplelocation.organization.history_samplelocation.history_samplelocation_organization_id_fkey") + + // Relationship Contexts for history_servicerequest + historyServicerequestWithParentsCascadingCtx = newContextual[bool]("historyServicerequestWithParentsCascading") + historyServicerequestRelOrganizationCtx = newContextual[bool]("history_servicerequest.organization.history_servicerequest.history_servicerequest_organization_id_fkey") + + // Relationship Contexts for history_speciesabundance + historySpeciesabundanceWithParentsCascadingCtx = newContextual[bool]("historySpeciesabundanceWithParentsCascading") + historySpeciesabundanceRelOrganizationCtx = newContextual[bool]("history_speciesabundance.organization.history_speciesabundance.history_speciesabundance_organization_id_fkey") + + // Relationship Contexts for history_stormdrain + historyStormdrainWithParentsCascadingCtx = newContextual[bool]("historyStormdrainWithParentsCascading") + historyStormdrainRelOrganizationCtx = newContextual[bool]("history_stormdrain.organization.history_stormdrain.history_stormdrain_organization_id_fkey") + + // Relationship Contexts for history_timecard + historyTimecardWithParentsCascadingCtx = newContextual[bool]("historyTimecardWithParentsCascading") + historyTimecardRelOrganizationCtx = newContextual[bool]("history_timecard.organization.history_timecard.history_timecard_organization_id_fkey") + + // Relationship Contexts for history_trapdata + historyTrapdatumWithParentsCascadingCtx = newContextual[bool]("historyTrapdatumWithParentsCascading") + historyTrapdatumRelOrganizationCtx = newContextual[bool]("history_trapdata.organization.history_trapdata.history_trapdata_organization_id_fkey") + + // Relationship Contexts for history_traplocation + historyTraplocationWithParentsCascadingCtx = newContextual[bool]("historyTraplocationWithParentsCascading") + historyTraplocationRelOrganizationCtx = newContextual[bool]("history_traplocation.organization.history_traplocation.history_traplocation_organization_id_fkey") + + // Relationship Contexts for history_treatment + historyTreatmentWithParentsCascadingCtx = newContextual[bool]("historyTreatmentWithParentsCascading") + historyTreatmentRelOrganizationCtx = newContextual[bool]("history_treatment.organization.history_treatment.history_treatment_organization_id_fkey") + + // Relationship Contexts for history_treatmentarea + historyTreatmentareaWithParentsCascadingCtx = newContextual[bool]("historyTreatmentareaWithParentsCascading") + historyTreatmentareaRelOrganizationCtx = newContextual[bool]("history_treatmentarea.organization.history_treatmentarea.history_treatmentarea_organization_id_fkey") + + // Relationship Contexts for history_zones + historyZoneWithParentsCascadingCtx = newContextual[bool]("historyZoneWithParentsCascading") + historyZoneRelOrganizationCtx = newContextual[bool]("history_zones.organization.history_zones.history_zones_organization_id_fkey") + + // Relationship Contexts for history_zones2 + historyZones2WithParentsCascadingCtx = newContextual[bool]("historyZones2WithParentsCascading") + historyZones2RelOrganizationCtx = newContextual[bool]("history_zones2.organization.history_zones2.history_zones2_organization_id_fkey") + // Relationship Contexts for oauth_token oauthTokenWithParentsCascadingCtx = newContextual[bool]("oauthTokenWithParentsCascading") oauthTokenRelUserUserCtx = newContextual[bool]("oauth_token.user_.oauth_token.oauth_token_user_id_fkey") // Relationship Contexts for organization - organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading") - organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey") + organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading") + 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") + organizationRelFSInspectionsamplesCtx = newContextual[bool]("fs_inspectionsample.organization.fs_inspectionsample.fs_inspectionsample_organization_id_fkey") + organizationRelFSInspectionsampledetailsCtx = newContextual[bool]("fs_inspectionsampledetail.organization.fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey") + organizationRelFSLinelocationsCtx = newContextual[bool]("fs_linelocation.organization.fs_linelocation.fs_linelocation_organization_id_fkey") + organizationRelFSLocationtrackingsCtx = newContextual[bool]("fs_locationtracking.organization.fs_locationtracking.fs_locationtracking_organization_id_fkey") + organizationRelFSMosquitoinspectionsCtx = newContextual[bool]("fs_mosquitoinspection.organization.fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey") + organizationRelFSPointlocationsCtx = newContextual[bool]("fs_pointlocation.organization.fs_pointlocation.fs_pointlocation_organization_id_fkey") + organizationRelFSPolygonlocationsCtx = newContextual[bool]("fs_polygonlocation.organization.fs_polygonlocation.fs_polygonlocation_organization_id_fkey") + organizationRelFSPoolsCtx = newContextual[bool]("fs_pool.organization.fs_pool.fs_pool_organization_id_fkey") + organizationRelFSPooldetailsCtx = newContextual[bool]("fs_pooldetail.organization.fs_pooldetail.fs_pooldetail_organization_id_fkey") + organizationRelFSProposedtreatmentareasCtx = newContextual[bool]("fs_proposedtreatmentarea.organization.fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey") + organizationRelFSQamosquitoinspectionsCtx = newContextual[bool]("fs_qamosquitoinspection.organization.fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey") + organizationRelFSRodentlocationsCtx = newContextual[bool]("fs_rodentlocation.organization.fs_rodentlocation.fs_rodentlocation_organization_id_fkey") + organizationRelFSSamplecollectionsCtx = newContextual[bool]("fs_samplecollection.organization.fs_samplecollection.fs_samplecollection_organization_id_fkey") + organizationRelFSSamplelocationsCtx = newContextual[bool]("fs_samplelocation.organization.fs_samplelocation.fs_samplelocation_organization_id_fkey") + organizationRelFSServicerequestsCtx = newContextual[bool]("fs_servicerequest.organization.fs_servicerequest.fs_servicerequest_organization_id_fkey") + organizationRelFSSpeciesabundancesCtx = newContextual[bool]("fs_speciesabundance.organization.fs_speciesabundance.fs_speciesabundance_organization_id_fkey") + organizationRelFSStormdrainsCtx = newContextual[bool]("fs_stormdrain.organization.fs_stormdrain.fs_stormdrain_organization_id_fkey") + organizationRelFSTimecardsCtx = newContextual[bool]("fs_timecard.organization.fs_timecard.fs_timecard_organization_id_fkey") + organizationRelFSTrapdataCtx = newContextual[bool]("fs_trapdata.organization.fs_trapdata.fs_trapdata_organization_id_fkey") + organizationRelFSTraplocationsCtx = newContextual[bool]("fs_traplocation.organization.fs_traplocation.fs_traplocation_organization_id_fkey") + organizationRelFSTreatmentsCtx = newContextual[bool]("fs_treatment.organization.fs_treatment.fs_treatment_organization_id_fkey") + organizationRelFSTreatmentareasCtx = newContextual[bool]("fs_treatmentarea.organization.fs_treatmentarea.fs_treatmentarea_organization_id_fkey") + organizationRelFSZonesCtx = newContextual[bool]("fs_zones.organization.fs_zones.fs_zones_organization_id_fkey") + organizationRelFSZones2sCtx = newContextual[bool]("fs_zones2.organization.fs_zones2.fs_zones2_organization_id_fkey") + organizationRelHistoryContainerrelatesCtx = newContextual[bool]("history_containerrelate.organization.history_containerrelate.history_containerrelate_organization_id_fkey") + organizationRelHistoryFieldscoutinglogsCtx = newContextual[bool]("history_fieldscoutinglog.organization.history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey") + organizationRelHistoryHabitatrelatesCtx = newContextual[bool]("history_habitatrelate.organization.history_habitatrelate.history_habitatrelate_organization_id_fkey") + organizationRelHistoryInspectionsamplesCtx = newContextual[bool]("history_inspectionsample.organization.history_inspectionsample.history_inspectionsample_organization_id_fkey") + organizationRelHistoryInspectionsampledetailsCtx = newContextual[bool]("history_inspectionsampledetail.organization.history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey") + organizationRelHistoryLinelocationsCtx = newContextual[bool]("history_linelocation.organization.history_linelocation.history_linelocation_organization_id_fkey") + organizationRelHistoryLocationtrackingsCtx = newContextual[bool]("history_locationtracking.organization.history_locationtracking.history_locationtracking_organization_id_fkey") + organizationRelHistoryMosquitoinspectionsCtx = newContextual[bool]("history_mosquitoinspection.organization.history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey") + organizationRelHistoryPointlocationsCtx = newContextual[bool]("history_pointlocation.organization.history_pointlocation.history_pointlocation_organization_id_fkey") + organizationRelHistoryPolygonlocationsCtx = newContextual[bool]("history_polygonlocation.organization.history_polygonlocation.history_polygonlocation_organization_id_fkey") + organizationRelHistoryPoolsCtx = newContextual[bool]("history_pool.organization.history_pool.history_pool_organization_id_fkey") + organizationRelHistoryPooldetailsCtx = newContextual[bool]("history_pooldetail.organization.history_pooldetail.history_pooldetail_organization_id_fkey") + organizationRelHistoryProposedtreatmentareasCtx = newContextual[bool]("history_proposedtreatmentarea.organization.history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey") + organizationRelHistoryQamosquitoinspectionsCtx = newContextual[bool]("history_qamosquitoinspection.organization.history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey") + organizationRelHistoryRodentlocationsCtx = newContextual[bool]("history_rodentlocation.organization.history_rodentlocation.history_rodentlocation_organization_id_fkey") + organizationRelHistorySamplecollectionsCtx = newContextual[bool]("history_samplecollection.organization.history_samplecollection.history_samplecollection_organization_id_fkey") + organizationRelHistorySamplelocationsCtx = newContextual[bool]("history_samplelocation.organization.history_samplelocation.history_samplelocation_organization_id_fkey") + organizationRelHistoryServicerequestsCtx = newContextual[bool]("history_servicerequest.organization.history_servicerequest.history_servicerequest_organization_id_fkey") + organizationRelHistorySpeciesabundancesCtx = newContextual[bool]("history_speciesabundance.organization.history_speciesabundance.history_speciesabundance_organization_id_fkey") + organizationRelHistoryStormdrainsCtx = newContextual[bool]("history_stormdrain.organization.history_stormdrain.history_stormdrain_organization_id_fkey") + organizationRelHistoryTimecardsCtx = newContextual[bool]("history_timecard.organization.history_timecard.history_timecard_organization_id_fkey") + organizationRelHistoryTrapdataCtx = newContextual[bool]("history_trapdata.organization.history_trapdata.history_trapdata_organization_id_fkey") + organizationRelHistoryTraplocationsCtx = newContextual[bool]("history_traplocation.organization.history_traplocation.history_traplocation_organization_id_fkey") + organizationRelHistoryTreatmentsCtx = newContextual[bool]("history_treatment.organization.history_treatment.history_treatment_organization_id_fkey") + organizationRelHistoryTreatmentareasCtx = newContextual[bool]("history_treatmentarea.organization.history_treatmentarea.history_treatmentarea_organization_id_fkey") + organizationRelHistoryZonesCtx = newContextual[bool]("history_zones.organization.history_zones.history_zones_organization_id_fkey") + organizationRelHistoryZones2sCtx = newContextual[bool]("history_zones2.organization.history_zones2.history_zones2_organization_id_fkey") + organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey") // Relationship Contexts for sessions sessionWithParentsCascadingCtx = newContextual[bool]("sessionWithParentsCascading") diff --git a/factory/bobfactory_main.bob.go b/factory/bobfactory_main.bob.go index 5f009b21..3c91784d 100644 --- a/factory/bobfactory_main.bob.go +++ b/factory/bobfactory_main.bob.go @@ -13,17 +13,1784 @@ import ( ) type Factory struct { - baseGooseDBVersionMods GooseDBVersionModSlice - baseOauthTokenMods OauthTokenModSlice - baseOrganizationMods OrganizationModSlice - baseSessionMods SessionModSlice - baseUserMods UserModSlice + baseFSContainerrelateMods FSContainerrelateModSlice + baseFSFieldscoutinglogMods FSFieldscoutinglogModSlice + baseFSHabitatrelateMods FSHabitatrelateModSlice + baseFSInspectionsampleMods FSInspectionsampleModSlice + baseFSInspectionsampledetailMods FSInspectionsampledetailModSlice + baseFSLinelocationMods FSLinelocationModSlice + baseFSLocationtrackingMods FSLocationtrackingModSlice + baseFSMosquitoinspectionMods FSMosquitoinspectionModSlice + baseFSPointlocationMods FSPointlocationModSlice + baseFSPolygonlocationMods FSPolygonlocationModSlice + baseFSPoolMods FSPoolModSlice + baseFSPooldetailMods FSPooldetailModSlice + baseFSProposedtreatmentareaMods FSProposedtreatmentareaModSlice + baseFSQamosquitoinspectionMods FSQamosquitoinspectionModSlice + baseFSRodentlocationMods FSRodentlocationModSlice + baseFSSamplecollectionMods FSSamplecollectionModSlice + baseFSSamplelocationMods FSSamplelocationModSlice + baseFSServicerequestMods FSServicerequestModSlice + baseFSSpeciesabundanceMods FSSpeciesabundanceModSlice + baseFSStormdrainMods FSStormdrainModSlice + baseFSTimecardMods FSTimecardModSlice + baseFSTrapdatumMods FSTrapdatumModSlice + baseFSTraplocationMods FSTraplocationModSlice + baseFSTreatmentMods FSTreatmentModSlice + baseFSTreatmentareaMods FSTreatmentareaModSlice + baseFSZoneMods FSZoneModSlice + baseFSZones2Mods FSZones2ModSlice + baseGooseDBVersionMods GooseDBVersionModSlice + baseHistoryContainerrelateMods HistoryContainerrelateModSlice + baseHistoryFieldscoutinglogMods HistoryFieldscoutinglogModSlice + baseHistoryHabitatrelateMods HistoryHabitatrelateModSlice + baseHistoryInspectionsampleMods HistoryInspectionsampleModSlice + baseHistoryInspectionsampledetailMods HistoryInspectionsampledetailModSlice + baseHistoryLinelocationMods HistoryLinelocationModSlice + baseHistoryLocationtrackingMods HistoryLocationtrackingModSlice + baseHistoryMosquitoinspectionMods HistoryMosquitoinspectionModSlice + baseHistoryPointlocationMods HistoryPointlocationModSlice + baseHistoryPolygonlocationMods HistoryPolygonlocationModSlice + baseHistoryPoolMods HistoryPoolModSlice + baseHistoryPooldetailMods HistoryPooldetailModSlice + baseHistoryProposedtreatmentareaMods HistoryProposedtreatmentareaModSlice + baseHistoryQamosquitoinspectionMods HistoryQamosquitoinspectionModSlice + baseHistoryRodentlocationMods HistoryRodentlocationModSlice + baseHistorySamplecollectionMods HistorySamplecollectionModSlice + baseHistorySamplelocationMods HistorySamplelocationModSlice + baseHistoryServicerequestMods HistoryServicerequestModSlice + baseHistorySpeciesabundanceMods HistorySpeciesabundanceModSlice + baseHistoryStormdrainMods HistoryStormdrainModSlice + baseHistoryTimecardMods HistoryTimecardModSlice + baseHistoryTrapdatumMods HistoryTrapdatumModSlice + baseHistoryTraplocationMods HistoryTraplocationModSlice + baseHistoryTreatmentMods HistoryTreatmentModSlice + baseHistoryTreatmentareaMods HistoryTreatmentareaModSlice + baseHistoryZoneMods HistoryZoneModSlice + baseHistoryZones2Mods HistoryZones2ModSlice + baseOauthTokenMods OauthTokenModSlice + baseOrganizationMods OrganizationModSlice + baseSessionMods SessionModSlice + baseUserMods UserModSlice } func New() *Factory { return &Factory{} } +func (f *Factory) NewFSContainerrelate(mods ...FSContainerrelateMod) *FSContainerrelateTemplate { + return f.NewFSContainerrelateWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSContainerrelateWithContext(ctx context.Context, mods ...FSContainerrelateMod) *FSContainerrelateTemplate { + o := &FSContainerrelateTemplate{f: f} + + if f != nil { + f.baseFSContainerrelateMods.Apply(ctx, o) + } + + FSContainerrelateModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSContainerrelate(m *models.FSContainerrelate) *FSContainerrelateTemplate { + o := &FSContainerrelateTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Inspsampleid = func() null.Val[string] { return m.Inspsampleid } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSContainerrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSFieldscoutinglog(mods ...FSFieldscoutinglogMod) *FSFieldscoutinglogTemplate { + return f.NewFSFieldscoutinglogWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSFieldscoutinglogWithContext(ctx context.Context, mods ...FSFieldscoutinglogMod) *FSFieldscoutinglogTemplate { + o := &FSFieldscoutinglogTemplate{f: f} + + if f != nil { + f.baseFSFieldscoutinglogMods.Apply(ctx, o) + } + + FSFieldscoutinglogModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSFieldscoutinglog(m *models.FSFieldscoutinglog) *FSFieldscoutinglogTemplate { + o := &FSFieldscoutinglogTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSFieldscoutinglogMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSHabitatrelate(mods ...FSHabitatrelateMod) *FSHabitatrelateTemplate { + return f.NewFSHabitatrelateWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSHabitatrelateWithContext(ctx context.Context, mods ...FSHabitatrelateMod) *FSHabitatrelateTemplate { + o := &FSHabitatrelateTemplate{f: f} + + if f != nil { + f.baseFSHabitatrelateMods.Apply(ctx, o) + } + + FSHabitatrelateModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSHabitatrelate(m *models.FSHabitatrelate) *FSHabitatrelateTemplate { + o := &FSHabitatrelateTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.ForeignID = func() null.Val[string] { return m.ForeignID } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSHabitatrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSInspectionsample(mods ...FSInspectionsampleMod) *FSInspectionsampleTemplate { + return f.NewFSInspectionsampleWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSInspectionsampleWithContext(ctx context.Context, mods ...FSInspectionsampleMod) *FSInspectionsampleTemplate { + o := &FSInspectionsampleTemplate{f: f} + + if f != nil { + f.baseFSInspectionsampleMods.Apply(ctx, o) + } + + FSInspectionsampleModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSInspectionsample(m *models.FSInspectionsample) *FSInspectionsampleTemplate { + o := &FSInspectionsampleTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Idbytech = func() null.Val[string] { return m.Idbytech } + o.InspID = func() null.Val[string] { return m.InspID } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSInspectionsampleMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSInspectionsampledetail(mods ...FSInspectionsampledetailMod) *FSInspectionsampledetailTemplate { + return f.NewFSInspectionsampledetailWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSInspectionsampledetailWithContext(ctx context.Context, mods ...FSInspectionsampledetailMod) *FSInspectionsampledetailTemplate { + o := &FSInspectionsampledetailTemplate{f: f} + + if f != nil { + f.baseFSInspectionsampledetailMods.Apply(ctx, o) + } + + FSInspectionsampledetailModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSInspectionsampledetail(m *models.FSInspectionsampledetail) *FSInspectionsampledetailTemplate { + o := &FSInspectionsampledetailTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fadultact = func() null.Val[string] { return m.Fadultact } + o.Fdomstage = func() null.Val[string] { return m.Fdomstage } + o.Feggcount = func() null.Val[int16] { return m.Feggcount } + o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } + o.Flarvcount = func() null.Val[int16] { return m.Flarvcount } + o.Flstages = func() null.Val[string] { return m.Flstages } + o.Fpupcount = func() null.Val[int16] { return m.Fpupcount } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.InspsampleID = func() null.Val[string] { return m.InspsampleID } + o.Labspecies = func() null.Val[string] { return m.Labspecies } + o.Ldomstage = func() null.Val[string] { return m.Ldomstage } + o.Leggcount = func() null.Val[int16] { return m.Leggcount } + o.Llarvcount = func() null.Val[int16] { return m.Llarvcount } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSInspectionsampledetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSLinelocation(mods ...FSLinelocationMod) *FSLinelocationTemplate { + return f.NewFSLinelocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSLinelocationWithContext(ctx context.Context, mods ...FSLinelocationMod) *FSLinelocationTemplate { + o := &FSLinelocationTemplate{f: f} + + if f != nil { + f.baseFSLinelocationMods.Apply(ctx, o) + } + + FSLinelocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSLinelocation(m *models.FSLinelocation) *FSLinelocationTemplate { + o := &FSLinelocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.LengthFT = func() null.Val[float64] { return m.LengthFT } + o.LengthMeters = func() null.Val[float64] { return m.LengthMeters } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.WidthFT = func() null.Val[float64] { return m.WidthFT } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSLinelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSLocationtracking(mods ...FSLocationtrackingMod) *FSLocationtrackingTemplate { + return f.NewFSLocationtrackingWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSLocationtrackingWithContext(ctx context.Context, mods ...FSLocationtrackingMod) *FSLocationtrackingTemplate { + o := &FSLocationtrackingTemplate{f: f} + + if f != nil { + f.baseFSLocationtrackingMods.Apply(ctx, o) + } + + FSLocationtrackingModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSLocationtracking(m *models.FSLocationtracking) *FSLocationtrackingTemplate { + o := &FSLocationtrackingTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSLocationtrackingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSMosquitoinspection(mods ...FSMosquitoinspectionMod) *FSMosquitoinspectionTemplate { + return f.NewFSMosquitoinspectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSMosquitoinspectionWithContext(ctx context.Context, mods ...FSMosquitoinspectionMod) *FSMosquitoinspectionTemplate { + o := &FSMosquitoinspectionTemplate{f: f} + + if f != nil { + f.baseFSMosquitoinspectionMods.Apply(ctx, o) + } + + FSMosquitoinspectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSMosquitoinspection(m *models.FSMosquitoinspection) *FSMosquitoinspectionTemplate { + o := &FSMosquitoinspectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Avetemp = func() null.Val[float64] { return m.Avetemp } + o.Avglarvae = func() null.Val[float64] { return m.Avglarvae } + o.Avgpupae = func() null.Val[float64] { return m.Avgpupae } + o.Breeding = func() null.Val[string] { return m.Breeding } + o.Cbcount = func() null.Val[int16] { return m.Cbcount } + o.Comments = func() null.Val[string] { return m.Comments } + o.Containercount = func() null.Val[int16] { return m.Containercount } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Domstage = func() null.Val[string] { return m.Domstage } + o.Eggs = func() null.Val[int16] { return m.Eggs } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Lstages = func() null.Val[string] { return m.Lstages } + o.Numdips = func() null.Val[int16] { return m.Numdips } + o.Objectid = func() int32 { return m.Objectid } + o.Personalcontact = func() null.Val[int16] { return m.Personalcontact } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Posdips = func() null.Val[int16] { return m.Posdips } + o.Positivecontainercount = func() null.Val[int16] { return m.Positivecontainercount } + o.Pupaepresent = func() null.Val[int16] { return m.Pupaepresent } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sdid = func() null.Val[string] { return m.Sdid } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Tirecount = func() null.Val[int16] { return m.Tirecount } + o.Totlarvae = func() null.Val[int16] { return m.Totlarvae } + o.Totpupae = func() null.Val[int16] { return m.Totpupae } + o.Visualmonitoring = func() null.Val[int16] { return m.Visualmonitoring } + o.Vmcomments = func() null.Val[string] { return m.Vmcomments } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Adminaction = func() null.Val[string] { return m.Adminaction } + o.Ptaid = func() null.Val[string] { return m.Ptaid } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSMosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSPointlocation(mods ...FSPointlocationMod) *FSPointlocationTemplate { + return f.NewFSPointlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSPointlocationWithContext(ctx context.Context, mods ...FSPointlocationMod) *FSPointlocationTemplate { + o := &FSPointlocationTemplate{f: f} + + if f != nil { + f.baseFSPointlocationMods.Apply(ctx, o) + } + + FSPointlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSPointlocation(m *models.FSPointlocation) *FSPointlocationTemplate { + o := &FSPointlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Stype = func() null.Val[string] { return m.Stype } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.X = func() null.Val[float64] { return m.X } + o.Y = func() null.Val[float64] { return m.Y } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Assignedtech = func() null.Val[string] { return m.Assignedtech } + o.DeactivateReason = func() null.Val[string] { return m.DeactivateReason } + o.Scalarpriority = func() null.Val[int64] { return m.Scalarpriority } + o.Sourcestatus = func() null.Val[string] { return m.Sourcestatus } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSPointlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSPolygonlocation(mods ...FSPolygonlocationMod) *FSPolygonlocationTemplate { + return f.NewFSPolygonlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSPolygonlocationWithContext(ctx context.Context, mods ...FSPolygonlocationMod) *FSPolygonlocationTemplate { + o := &FSPolygonlocationTemplate{f: f} + + if f != nil { + f.baseFSPolygonlocationMods.Apply(ctx, o) + } + + FSPolygonlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSPolygonlocation(m *models.FSPolygonlocation) *FSPolygonlocationTemplate { + o := &FSPolygonlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Filter = func() null.Val[string] { return m.Filter } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSPolygonlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSPool(mods ...FSPoolMod) *FSPoolTemplate { + return f.NewFSPoolWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSPoolWithContext(ctx context.Context, mods ...FSPoolMod) *FSPoolTemplate { + o := &FSPoolTemplate{f: f} + + if f != nil { + f.baseFSPoolMods.Apply(ctx, o) + } + + FSPoolModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSPool(m *models.FSPool) *FSPoolTemplate { + o := &FSPoolTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Datesent = func() null.Val[int64] { return m.Datesent } + o.Datetested = func() null.Val[int64] { return m.Datetested } + o.Diseasepos = func() null.Val[string] { return m.Diseasepos } + o.Diseasetested = func() null.Val[string] { return m.Diseasetested } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lab = func() null.Val[string] { return m.Lab } + o.LabID = func() null.Val[string] { return m.LabID } + o.Objectid = func() int32 { return m.Objectid } + o.Poolyear = func() null.Val[int16] { return m.Poolyear } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Sampleid = func() null.Val[string] { return m.Sampleid } + o.Survtech = func() null.Val[string] { return m.Survtech } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Vectorsurvcollectionid = func() null.Val[string] { return m.Vectorsurvcollectionid } + o.Vectorsurvpoolid = func() null.Val[string] { return m.Vectorsurvpoolid } + o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSPoolMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSPooldetail(mods ...FSPooldetailMod) *FSPooldetailTemplate { + return f.NewFSPooldetailWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSPooldetailWithContext(ctx context.Context, mods ...FSPooldetailMod) *FSPooldetailTemplate { + o := &FSPooldetailTemplate{f: f} + + if f != nil { + f.baseFSPooldetailMods.Apply(ctx, o) + } + + FSPooldetailModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSPooldetail(m *models.FSPooldetail) *FSPooldetailTemplate { + o := &FSPooldetailTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Females = func() null.Val[int16] { return m.Females } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Objectid = func() int32 { return m.Objectid } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSPooldetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSProposedtreatmentarea(mods ...FSProposedtreatmentareaMod) *FSProposedtreatmentareaTemplate { + return f.NewFSProposedtreatmentareaWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSProposedtreatmentareaWithContext(ctx context.Context, mods ...FSProposedtreatmentareaMod) *FSProposedtreatmentareaTemplate { + o := &FSProposedtreatmentareaTemplate{f: f} + + if f != nil { + f.baseFSProposedtreatmentareaMods.Apply(ctx, o) + } + + FSProposedtreatmentareaModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSProposedtreatmentarea(m *models.FSProposedtreatmentarea) *FSProposedtreatmentareaTemplate { + o := &FSProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Completedby = func() null.Val[string] { return m.Completedby } + o.Completeddate = func() null.Val[int64] { return m.Completeddate } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Duedate = func() null.Val[int64] { return m.Duedate } + o.Exported = func() null.Val[int16] { return m.Exported } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Issprayroute = func() null.Val[int16] { return m.Issprayroute } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Method = func() null.Val[string] { return m.Method } + o.Name = func() null.Val[string] { return m.Name } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Targetapprate = func() null.Val[float64] { return m.Targetapprate } + o.Targetproduct = func() null.Val[string] { return m.Targetproduct } + o.Targetspecies = func() null.Val[string] { return m.Targetspecies } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSProposedtreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSQamosquitoinspection(mods ...FSQamosquitoinspectionMod) *FSQamosquitoinspectionTemplate { + return f.NewFSQamosquitoinspectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSQamosquitoinspectionWithContext(ctx context.Context, mods ...FSQamosquitoinspectionMod) *FSQamosquitoinspectionTemplate { + o := &FSQamosquitoinspectionTemplate{f: f} + + if f != nil { + f.baseFSQamosquitoinspectionMods.Apply(ctx, o) + } + + FSQamosquitoinspectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSQamosquitoinspection(m *models.FSQamosquitoinspection) *FSQamosquitoinspectionTemplate { + o := &FSQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Aquaticorganisms = func() null.Val[string] { return m.Aquaticorganisms } + o.Avetemp = func() null.Val[float64] { return m.Avetemp } + o.Breedingpotential = func() null.Val[string] { return m.Breedingpotential } + 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 } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Fish = func() null.Val[int16] { return m.Fish } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habvalue1 = func() null.Val[int16] { return m.Habvalue1 } + o.Habvalue1percent = func() null.Val[int16] { return m.Habvalue1percent } + o.Habvalue2 = func() null.Val[int16] { return m.Habvalue2 } + o.Habvalue2percent = func() null.Val[int16] { return m.Habvalue2percent } + o.Larvaeinsidetreatedarea = func() null.Val[int16] { return m.Larvaeinsidetreatedarea } + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return m.Larvaeoutsidetreatedarea } + o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } + o.Larvaereason = func() null.Val[string] { return m.Larvaereason } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LR = func() null.Val[int16] { return m.LR } + o.Mosquitohabitat = func() null.Val[string] { return m.Mosquitohabitat } + o.Movingwater = func() null.Val[int16] { return m.Movingwater } + o.Negdips = func() null.Val[int16] { return m.Negdips } + o.Nowaterever = func() null.Val[int16] { return m.Nowaterever } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Posdips = func() null.Val[int16] { return m.Posdips } + o.Potential = func() null.Val[int16] { return m.Potential } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sitetype = func() null.Val[string] { return m.Sitetype } + o.Soilconditions = func() null.Val[string] { return m.Soilconditions } + o.Sourcereduction = func() null.Val[string] { return m.Sourcereduction } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Totalacres = func() null.Val[float64] { return m.Totalacres } + o.Vegetation = func() null.Val[string] { return m.Vegetation } + o.Waterconditions = func() null.Val[string] { return m.Waterconditions } + o.Waterduration = func() null.Val[string] { return m.Waterduration } + o.Watermovement1 = func() null.Val[string] { return m.Watermovement1 } + o.Watermovement1percent = func() null.Val[int16] { return m.Watermovement1percent } + o.Watermovement2 = func() null.Val[string] { return m.Watermovement2 } + o.Watermovement2percent = func() null.Val[int16] { return m.Watermovement2percent } + o.Waterpresent = func() null.Val[int16] { return m.Waterpresent } + o.Watersource = func() null.Val[string] { return m.Watersource } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSQamosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSRodentlocation(mods ...FSRodentlocationMod) *FSRodentlocationTemplate { + return f.NewFSRodentlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSRodentlocationWithContext(ctx context.Context, mods ...FSRodentlocationMod) *FSRodentlocationTemplate { + o := &FSRodentlocationTemplate{f: f} + + if f != nil { + f.baseFSRodentlocationMods.Apply(ctx, o) + } + + FSRodentlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSRodentlocation(m *models.FSRodentlocation) *FSRodentlocationTemplate { + o := &FSRodentlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Lastinspectaction = func() null.Val[string] { return m.Lastinspectaction } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectrodentevidence = func() null.Val[string] { return m.Lastinspectrodentevidence } + o.Lastinspectspecies = func() null.Val[string] { return m.Lastinspectspecies } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSRodentlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSSamplecollection(mods ...FSSamplecollectionMod) *FSSamplecollectionTemplate { + return f.NewFSSamplecollectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSSamplecollectionWithContext(ctx context.Context, mods ...FSSamplecollectionMod) *FSSamplecollectionTemplate { + o := &FSSamplecollectionTemplate{f: f} + + if f != nil { + f.baseFSSamplecollectionMods.Apply(ctx, o) + } + + FSSamplecollectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSSamplecollection(m *models.FSSamplecollection) *FSSamplecollectionTemplate { + o := &FSSamplecollectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Datesent = func() null.Val[int64] { return m.Datesent } + o.Datetested = func() null.Val[int64] { return m.Datetested } + o.Diseasepos = func() null.Val[string] { return m.Diseasepos } + o.Diseasetested = func() null.Val[string] { return m.Diseasetested } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Flockid = func() null.Val[string] { return m.Flockid } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lab = func() null.Val[string] { return m.Lab } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LocID = func() null.Val[string] { return m.LocID } + o.Objectid = func() int32 { return m.Objectid } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Samplecond = func() null.Val[string] { return m.Samplecond } + o.Samplecount = func() null.Val[int16] { return m.Samplecount } + o.Sampleid = func() null.Val[string] { return m.Sampleid } + o.Sampletype = func() null.Val[string] { return m.Sampletype } + o.Sex = func() null.Val[string] { return m.Sex } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Species = func() null.Val[string] { return m.Species } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Survtech = func() null.Val[string] { return m.Survtech } + o.Testmethod = func() null.Val[string] { return m.Testmethod } + o.Testtech = func() null.Val[string] { return m.Testtech } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSSamplecollectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSSamplelocation(mods ...FSSamplelocationMod) *FSSamplelocationTemplate { + return f.NewFSSamplelocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSSamplelocationWithContext(ctx context.Context, mods ...FSSamplelocationMod) *FSSamplelocationTemplate { + o := &FSSamplelocationTemplate{f: f} + + if f != nil { + f.baseFSSamplelocationMods.Apply(ctx, o) + } + + FSSamplelocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSSamplelocation(m *models.FSSamplelocation) *FSSamplelocationTemplate { + o := &FSSamplelocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSSamplelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSServicerequest(mods ...FSServicerequestMod) *FSServicerequestTemplate { + return f.NewFSServicerequestWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSServicerequestWithContext(ctx context.Context, mods ...FSServicerequestMod) *FSServicerequestTemplate { + o := &FSServicerequestTemplate{f: f} + + if f != nil { + f.baseFSServicerequestMods.Apply(ctx, o) + } + + FSServicerequestModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSServicerequest(m *models.FSServicerequest) *FSServicerequestTemplate { + o := &FSServicerequestTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Allowed = func() null.Val[string] { return m.Allowed } + o.Assignedtech = func() null.Val[string] { return m.Assignedtech } + o.Clraddr1 = func() null.Val[string] { return m.Clraddr1 } + o.Clraddr2 = func() null.Val[string] { return m.Clraddr2 } + o.Clranon = func() null.Val[int16] { return m.Clranon } + o.Clrcity = func() null.Val[string] { return m.Clrcity } + o.Clrcompany = func() null.Val[string] { return m.Clrcompany } + o.Clrcontpref = func() null.Val[string] { return m.Clrcontpref } + o.Clremail = func() null.Val[string] { return m.Clremail } + o.Clrfname = func() null.Val[string] { return m.Clrfname } + o.Clrother = func() null.Val[string] { return m.Clrother } + o.Clrphone1 = func() null.Val[string] { return m.Clrphone1 } + o.Clrphone2 = func() null.Val[string] { return m.Clrphone2 } + o.Clrstate = func() null.Val[string] { return m.Clrstate } + o.Clrzip = func() null.Val[string] { return m.Clrzip } + 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 } + o.Datetimeclosed = func() null.Val[int64] { return m.Datetimeclosed } + o.Duedate = func() null.Val[int64] { return m.Duedate } + o.Entrytech = func() null.Val[string] { return m.Entrytech } + o.Estcompletedate = func() null.Val[int64] { return m.Estcompletedate } + o.Externalerror = func() null.Val[string] { return m.Externalerror } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Firstresponsedate = func() null.Val[int64] { return m.Firstresponsedate } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Issuesreported = func() null.Val[string] { return m.Issuesreported } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Nextaction = func() null.Val[string] { return m.Nextaction } + o.Notificationtimestamp = func() null.Val[string] { return m.Notificationtimestamp } + o.Notified = func() null.Val[int16] { return m.Notified } + o.Notifieddate = func() null.Val[int64] { return m.Notifieddate } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Recdatetime = func() null.Val[int64] { return m.Recdatetime } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Rejectedby = func() null.Val[string] { return m.Rejectedby } + o.Rejecteddate = func() null.Val[int64] { return m.Rejecteddate } + o.Rejectedreason = func() null.Val[string] { return m.Rejectedreason } + o.Reqaddr1 = func() null.Val[string] { return m.Reqaddr1 } + o.Reqaddr2 = func() null.Val[string] { return m.Reqaddr2 } + o.Reqcity = func() null.Val[string] { return m.Reqcity } + o.Reqcompany = func() null.Val[string] { return m.Reqcompany } + o.Reqcrossst = func() null.Val[string] { return m.Reqcrossst } + o.Reqdescr = func() null.Val[string] { return m.Reqdescr } + o.Reqfldnotes = func() null.Val[string] { return m.Reqfldnotes } + o.Reqmapgrid = func() null.Val[string] { return m.Reqmapgrid } + o.Reqnotesforcust = func() null.Val[string] { return m.Reqnotesforcust } + o.Reqnotesfortech = func() null.Val[string] { return m.Reqnotesfortech } + o.Reqpermission = func() null.Val[int16] { return m.Reqpermission } + o.Reqprogramactions = func() null.Val[string] { return m.Reqprogramactions } + o.Reqstate = func() null.Val[string] { return m.Reqstate } + o.Reqsubdiv = func() null.Val[string] { return m.Reqsubdiv } + o.Reqtarget = func() null.Val[string] { return m.Reqtarget } + o.Reqzip = func() null.Val[string] { return m.Reqzip } + o.Responsedaycount = func() null.Val[int16] { return m.Responsedaycount } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Scheduled = func() null.Val[int16] { return m.Scheduled } + o.Scheduleddate = func() null.Val[int64] { return m.Scheduleddate } + o.Source = func() null.Val[string] { return m.Source } + o.SRNumber = func() null.Val[int64] { return m.SRNumber } + o.Status = func() null.Val[string] { return m.Status } + o.Supervisor = func() null.Val[string] { return m.Supervisor } + o.Techclosed = func() null.Val[string] { return m.Techclosed } + o.Validx = func() null.Val[string] { return m.Validx } + o.Validy = func() null.Val[string] { return m.Validy } + o.Xvalue = func() null.Val[string] { return m.Xvalue } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Dog = func() null.Val[int64] { return m.Dog } + o.Spanish = func() null.Val[int64] { return m.Spanish } + o.ScheduleNotes = func() null.Val[string] { return m.ScheduleNotes } + o.SchedulePeriod = func() null.Val[string] { return m.SchedulePeriod } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSServicerequestMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSSpeciesabundance(mods ...FSSpeciesabundanceMod) *FSSpeciesabundanceTemplate { + return f.NewFSSpeciesabundanceWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSSpeciesabundanceWithContext(ctx context.Context, mods ...FSSpeciesabundanceMod) *FSSpeciesabundanceTemplate { + o := &FSSpeciesabundanceTemplate{f: f} + + if f != nil { + f.baseFSSpeciesabundanceMods.Apply(ctx, o) + } + + FSSpeciesabundanceModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSSpeciesabundance(m *models.FSSpeciesabundance) *FSSpeciesabundanceTemplate { + o := &FSSpeciesabundanceTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Eggs = func() null.Val[int16] { return m.Eggs } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Females = func() null.Val[int64] { return m.Females } + o.Gravidfem = func() null.Val[int16] { return m.Gravidfem } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Larvae = func() null.Val[int16] { return m.Larvae } + o.Males = func() null.Val[int16] { return m.Males } + o.Objectid = func() int32 { return m.Objectid } + o.Poolstogen = func() null.Val[int16] { return m.Poolstogen } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Pupae = func() null.Val[int16] { return m.Pupae } + o.Species = func() null.Val[string] { return m.Species } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Globalzscore = func() null.Val[float64] { return m.Globalzscore } + o.H3R7 = func() null.Val[string] { return m.H3R7 } + o.H3R8 = func() null.Val[string] { return m.H3R8 } + o.R7score = func() null.Val[float64] { return m.R7score } + o.R8score = func() null.Val[float64] { return m.R8score } + o.Yearweek = func() null.Val[int64] { return m.Yearweek } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSSpeciesabundanceMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSStormdrain(mods ...FSStormdrainMod) *FSStormdrainTemplate { + return f.NewFSStormdrainWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSStormdrainWithContext(ctx context.Context, mods ...FSStormdrainMod) *FSStormdrainTemplate { + o := &FSStormdrainTemplate{f: f} + + if f != nil { + f.baseFSStormdrainMods.Apply(ctx, o) + } + + FSStormdrainModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSStormdrain(m *models.FSStormdrain) *FSStormdrainTemplate { + o := &FSStormdrainTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Lastaction = func() null.Val[string] { return m.Lastaction } + o.Laststatus = func() null.Val[string] { return m.Laststatus } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Nexttreatmentdate = func() null.Val[int64] { return m.Nexttreatmentdate } + o.Objectid = func() int32 { return m.Objectid } + o.Symbology = func() null.Val[string] { return m.Symbology } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSStormdrainMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSTimecard(mods ...FSTimecardMod) *FSTimecardTemplate { + return f.NewFSTimecardWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSTimecardWithContext(ctx context.Context, mods ...FSTimecardMod) *FSTimecardTemplate { + o := &FSTimecardTemplate{f: f} + + if f != nil { + f.baseFSTimecardMods.Apply(ctx, o) + } + + FSTimecardModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSTimecard(m *models.FSTimecard) *FSTimecardTemplate { + o := &FSTimecardTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Equiptype = func() null.Val[string] { return m.Equiptype } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lclocid = func() null.Val[string] { return m.Lclocid } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Samplelocid = func() null.Val[string] { return m.Samplelocid } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Rodentlocid = func() null.Val[string] { return m.Rodentlocid } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSTimecardMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSTrapdatum(mods ...FSTrapdatumMod) *FSTrapdatumTemplate { + return f.NewFSTrapdatumWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSTrapdatumWithContext(ctx context.Context, mods ...FSTrapdatumMod) *FSTrapdatumTemplate { + o := &FSTrapdatumTemplate{f: f} + + if f != nil { + f.baseFSTrapdatumMods.Apply(ctx, o) + } + + FSTrapdatumModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSTrapdatum(m *models.FSTrapdatum) *FSTrapdatumTemplate { + o := &FSTrapdatumTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Field = func() null.Val[int64] { return m.Field } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Idbytech = func() null.Val[string] { return m.Idbytech } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LocID = func() null.Val[string] { return m.LocID } + o.LR = func() null.Val[int16] { return m.LR } + o.Objectid = func() int32 { return m.Objectid } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Sortbytech = func() null.Val[string] { return m.Sortbytech } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Trapactivitytype = func() null.Val[string] { return m.Trapactivitytype } + o.Trapcondition = func() null.Val[string] { return m.Trapcondition } + o.Trapnights = func() null.Val[int16] { return m.Trapnights } + o.Traptype = func() null.Val[string] { return m.Traptype } + o.Voltage = func() null.Val[float64] { return m.Voltage } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Lure = func() null.Val[string] { return m.Lure } + o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } + o.Vectorsurvtraplocationid = func() null.Val[string] { return m.Vectorsurvtraplocationid } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSTrapdatumMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSTraplocation(mods ...FSTraplocationMod) *FSTraplocationTemplate { + return f.NewFSTraplocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSTraplocationWithContext(ctx context.Context, mods ...FSTraplocationMod) *FSTraplocationTemplate { + o := &FSTraplocationTemplate{f: f} + + if f != nil { + f.baseFSTraplocationMods.Apply(ctx, o) + } + + FSTraplocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSTraplocation(m *models.FSTraplocation) *FSTraplocationTemplate { + o := &FSTraplocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Route = func() null.Val[int64] { return m.Route } + o.RouteOrder = func() null.Val[int64] { return m.RouteOrder } + o.SetDow = func() null.Val[int64] { return m.SetDow } + o.Vectorsurvsiteid = func() null.Val[string] { return m.Vectorsurvsiteid } + o.H3R7 = func() null.Val[string] { return m.H3R7 } + o.H3R8 = func() null.Val[string] { return m.H3R8 } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSTraplocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSTreatment(mods ...FSTreatmentMod) *FSTreatmentTemplate { + return f.NewFSTreatmentWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSTreatmentWithContext(ctx context.Context, mods ...FSTreatmentMod) *FSTreatmentTemplate { + o := &FSTreatmentTemplate{f: f} + + if f != nil { + f.baseFSTreatmentMods.Apply(ctx, o) + } + + FSTreatmentModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSTreatment(m *models.FSTreatment) *FSTreatmentTemplate { + o := &FSTreatmentTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Barrierrouteid = func() null.Val[string] { return m.Barrierrouteid } + o.Cbcount = func() null.Val[int16] { return m.Cbcount } + o.Comments = func() null.Val[string] { return m.Comments } + o.Containercount = func() null.Val[int16] { return m.Containercount } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Equiptype = func() null.Val[string] { return m.Equiptype } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Flowrate = func() null.Val[float64] { return m.Flowrate } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.InspID = func() null.Val[string] { return m.InspID } + o.Invloc = func() null.Val[string] { return m.Invloc } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Method = func() null.Val[string] { return m.Method } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Product = func() null.Val[string] { return m.Product } + o.Ptaid = func() null.Val[string] { return m.Ptaid } + o.Qty = func() null.Val[float64] { return m.Qty } + o.Qtyunit = func() null.Val[string] { return m.Qtyunit } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sdid = func() null.Val[string] { return m.Sdid } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Targetspecies = func() null.Val[string] { return m.Targetspecies } + o.Tirecount = func() null.Val[int16] { return m.Tirecount } + o.Treatacres = func() null.Val[float64] { return m.Treatacres } + o.Treatarea = func() null.Val[float64] { return m.Treatarea } + o.Treathectares = func() null.Val[float64] { return m.Treathectares } + o.Treatmenthours = func() null.Val[float64] { return m.Treatmenthours } + o.Treatmentlength = func() null.Val[float64] { return m.Treatmentlength } + o.Treatmentlengthunits = func() null.Val[string] { return m.Treatmentlengthunits } + o.Totalcostprodcut = func() null.Val[float64] { return m.Totalcostprodcut } + o.Ulvrouteid = func() null.Val[string] { return m.Ulvrouteid } + o.Warningoverride = func() null.Val[int16] { return m.Warningoverride } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.TempSitecond = func() null.Val[string] { return m.TempSitecond } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSTreatmentMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSTreatmentarea(mods ...FSTreatmentareaMod) *FSTreatmentareaTemplate { + return f.NewFSTreatmentareaWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSTreatmentareaWithContext(ctx context.Context, mods ...FSTreatmentareaMod) *FSTreatmentareaTemplate { + o := &FSTreatmentareaTemplate{f: f} + + if f != nil { + f.baseFSTreatmentareaMods.Apply(ctx, o) + } + + FSTreatmentareaModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSTreatmentarea(m *models.FSTreatmentarea) *FSTreatmentareaTemplate { + o := &FSTreatmentareaTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Notified = func() null.Val[int16] { return m.Notified } + o.Objectid = func() int32 { return m.Objectid } + o.SessionID = func() null.Val[string] { return m.SessionID } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSTreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSZone(mods ...FSZoneMod) *FSZoneTemplate { + return f.NewFSZoneWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSZoneWithContext(ctx context.Context, mods ...FSZoneMod) *FSZoneTemplate { + o := &FSZoneTemplate{f: f} + + if f != nil { + f.baseFSZoneMods.Apply(ctx, o) + } + + FSZoneModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSZone(m *models.FSZone) *FSZoneTemplate { + o := &FSZoneTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Name = func() null.Val[string] { return m.Name } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSZoneMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewFSZones2(mods ...FSZones2Mod) *FSZones2Template { + return f.NewFSZones2WithContext(context.Background(), mods...) +} + +func (f *Factory) NewFSZones2WithContext(ctx context.Context, mods ...FSZones2Mod) *FSZones2Template { + o := &FSZones2Template{f: f} + + if f != nil { + f.baseFSZones2Mods.Apply(ctx, o) + } + + FSZones2ModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFSZones2(m *models.FSZones2) *FSZones2Template { + o := &FSZones2Template{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Name = func() null.Val[string] { return m.Name } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Updated = func() time.Time { return m.Updated } + + ctx := context.Background() + if m.R.Organization != nil { + FSZones2Mods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + func (f *Factory) NewGooseDBVersion(mods ...GooseDBVersionMod) *GooseDBVersionTemplate { return f.NewGooseDBVersionWithContext(context.Background(), mods...) } @@ -51,6 +1818,1719 @@ func (f *Factory) FromExistingGooseDBVersion(m *models.GooseDBVersion) *GooseDBV return o } +func (f *Factory) NewHistoryContainerrelate(mods ...HistoryContainerrelateMod) *HistoryContainerrelateTemplate { + return f.NewHistoryContainerrelateWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryContainerrelateWithContext(ctx context.Context, mods ...HistoryContainerrelateMod) *HistoryContainerrelateTemplate { + o := &HistoryContainerrelateTemplate{f: f} + + if f != nil { + f.baseHistoryContainerrelateMods.Apply(ctx, o) + } + + HistoryContainerrelateModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryContainerrelate(m *models.HistoryContainerrelate) *HistoryContainerrelateTemplate { + o := &HistoryContainerrelateTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Inspsampleid = func() null.Val[string] { return m.Inspsampleid } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryContainerrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryFieldscoutinglog(mods ...HistoryFieldscoutinglogMod) *HistoryFieldscoutinglogTemplate { + return f.NewHistoryFieldscoutinglogWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryFieldscoutinglogWithContext(ctx context.Context, mods ...HistoryFieldscoutinglogMod) *HistoryFieldscoutinglogTemplate { + o := &HistoryFieldscoutinglogTemplate{f: f} + + if f != nil { + f.baseHistoryFieldscoutinglogMods.Apply(ctx, o) + } + + HistoryFieldscoutinglogModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglog) *HistoryFieldscoutinglogTemplate { + o := &HistoryFieldscoutinglogTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryFieldscoutinglogMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryHabitatrelate(mods ...HistoryHabitatrelateMod) *HistoryHabitatrelateTemplate { + return f.NewHistoryHabitatrelateWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryHabitatrelateWithContext(ctx context.Context, mods ...HistoryHabitatrelateMod) *HistoryHabitatrelateTemplate { + o := &HistoryHabitatrelateTemplate{f: f} + + if f != nil { + f.baseHistoryHabitatrelateMods.Apply(ctx, o) + } + + HistoryHabitatrelateModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelate) *HistoryHabitatrelateTemplate { + o := &HistoryHabitatrelateTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.ForeignID = func() null.Val[string] { return m.ForeignID } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryHabitatrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryInspectionsample(mods ...HistoryInspectionsampleMod) *HistoryInspectionsampleTemplate { + return f.NewHistoryInspectionsampleWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryInspectionsampleWithContext(ctx context.Context, mods ...HistoryInspectionsampleMod) *HistoryInspectionsampleTemplate { + o := &HistoryInspectionsampleTemplate{f: f} + + if f != nil { + f.baseHistoryInspectionsampleMods.Apply(ctx, o) + } + + HistoryInspectionsampleModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectionsample) *HistoryInspectionsampleTemplate { + o := &HistoryInspectionsampleTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Idbytech = func() null.Val[string] { return m.Idbytech } + o.InspID = func() null.Val[string] { return m.InspID } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryInspectionsampleMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryInspectionsampledetail(mods ...HistoryInspectionsampledetailMod) *HistoryInspectionsampledetailTemplate { + return f.NewHistoryInspectionsampledetailWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryInspectionsampledetailWithContext(ctx context.Context, mods ...HistoryInspectionsampledetailMod) *HistoryInspectionsampledetailTemplate { + o := &HistoryInspectionsampledetailTemplate{f: f} + + if f != nil { + f.baseHistoryInspectionsampledetailMods.Apply(ctx, o) + } + + HistoryInspectionsampledetailModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetail) *HistoryInspectionsampledetailTemplate { + o := &HistoryInspectionsampledetailTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fadultact = func() null.Val[string] { return m.Fadultact } + o.Fdomstage = func() null.Val[string] { return m.Fdomstage } + o.Feggcount = func() null.Val[int16] { return m.Feggcount } + o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } + o.Flarvcount = func() null.Val[int16] { return m.Flarvcount } + o.Flstages = func() null.Val[string] { return m.Flstages } + o.Fpupcount = func() null.Val[int16] { return m.Fpupcount } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.InspsampleID = func() null.Val[string] { return m.InspsampleID } + o.Labspecies = func() null.Val[string] { return m.Labspecies } + o.Ldomstage = func() null.Val[string] { return m.Ldomstage } + o.Leggcount = func() null.Val[int16] { return m.Leggcount } + o.Llarvcount = func() null.Val[int16] { return m.Llarvcount } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryInspectionsampledetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryLinelocation(mods ...HistoryLinelocationMod) *HistoryLinelocationTemplate { + return f.NewHistoryLinelocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryLinelocationWithContext(ctx context.Context, mods ...HistoryLinelocationMod) *HistoryLinelocationTemplate { + o := &HistoryLinelocationTemplate{f: f} + + if f != nil { + f.baseHistoryLinelocationMods.Apply(ctx, o) + } + + HistoryLinelocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation) *HistoryLinelocationTemplate { + o := &HistoryLinelocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.LengthFT = func() null.Val[float64] { return m.LengthFT } + o.LengthMeters = func() null.Val[float64] { return m.LengthMeters } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.WidthFT = func() null.Val[float64] { return m.WidthFT } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryLinelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryLocationtracking(mods ...HistoryLocationtrackingMod) *HistoryLocationtrackingTemplate { + return f.NewHistoryLocationtrackingWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryLocationtrackingWithContext(ctx context.Context, mods ...HistoryLocationtrackingMod) *HistoryLocationtrackingTemplate { + o := &HistoryLocationtrackingTemplate{f: f} + + if f != nil { + f.baseHistoryLocationtrackingMods.Apply(ctx, o) + } + + HistoryLocationtrackingModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationtracking) *HistoryLocationtrackingTemplate { + o := &HistoryLocationtrackingTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryLocationtrackingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryMosquitoinspection(mods ...HistoryMosquitoinspectionMod) *HistoryMosquitoinspectionTemplate { + return f.NewHistoryMosquitoinspectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryMosquitoinspectionWithContext(ctx context.Context, mods ...HistoryMosquitoinspectionMod) *HistoryMosquitoinspectionTemplate { + o := &HistoryMosquitoinspectionTemplate{f: f} + + if f != nil { + f.baseHistoryMosquitoinspectionMods.Apply(ctx, o) + } + + HistoryMosquitoinspectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquitoinspection) *HistoryMosquitoinspectionTemplate { + o := &HistoryMosquitoinspectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Avetemp = func() null.Val[float64] { return m.Avetemp } + o.Avglarvae = func() null.Val[float64] { return m.Avglarvae } + o.Avgpupae = func() null.Val[float64] { return m.Avgpupae } + o.Breeding = func() null.Val[string] { return m.Breeding } + o.Cbcount = func() null.Val[int16] { return m.Cbcount } + o.Comments = func() null.Val[string] { return m.Comments } + o.Containercount = func() null.Val[int16] { return m.Containercount } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Domstage = func() null.Val[string] { return m.Domstage } + o.Eggs = func() null.Val[int16] { return m.Eggs } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Lstages = func() null.Val[string] { return m.Lstages } + o.Numdips = func() null.Val[int16] { return m.Numdips } + o.Objectid = func() int32 { return m.Objectid } + o.Personalcontact = func() null.Val[int16] { return m.Personalcontact } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Posdips = func() null.Val[int16] { return m.Posdips } + o.Positivecontainercount = func() null.Val[int16] { return m.Positivecontainercount } + o.Pupaepresent = func() null.Val[int16] { return m.Pupaepresent } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sdid = func() null.Val[string] { return m.Sdid } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Tirecount = func() null.Val[int16] { return m.Tirecount } + o.Totlarvae = func() null.Val[int16] { return m.Totlarvae } + o.Totpupae = func() null.Val[int16] { return m.Totpupae } + o.Visualmonitoring = func() null.Val[int16] { return m.Visualmonitoring } + o.Vmcomments = func() null.Val[string] { return m.Vmcomments } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Adminaction = func() null.Val[string] { return m.Adminaction } + o.Ptaid = func() null.Val[string] { return m.Ptaid } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryMosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryPointlocation(mods ...HistoryPointlocationMod) *HistoryPointlocationTemplate { + return f.NewHistoryPointlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryPointlocationWithContext(ctx context.Context, mods ...HistoryPointlocationMod) *HistoryPointlocationTemplate { + o := &HistoryPointlocationTemplate{f: f} + + if f != nil { + f.baseHistoryPointlocationMods.Apply(ctx, o) + } + + HistoryPointlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryPointlocation(m *models.HistoryPointlocation) *HistoryPointlocationTemplate { + o := &HistoryPointlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Stype = func() null.Val[string] { return m.Stype } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.X = func() null.Val[float64] { return m.X } + o.Y = func() null.Val[float64] { return m.Y } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Assignedtech = func() null.Val[string] { return m.Assignedtech } + o.DeactivateReason = func() null.Val[string] { return m.DeactivateReason } + o.Scalarpriority = func() null.Val[int64] { return m.Scalarpriority } + o.Sourcestatus = func() null.Val[string] { return m.Sourcestatus } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryPointlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryPolygonlocation(mods ...HistoryPolygonlocationMod) *HistoryPolygonlocationTemplate { + return f.NewHistoryPolygonlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryPolygonlocationWithContext(ctx context.Context, mods ...HistoryPolygonlocationMod) *HistoryPolygonlocationTemplate { + o := &HistoryPolygonlocationTemplate{f: f} + + if f != nil { + f.baseHistoryPolygonlocationMods.Apply(ctx, o) + } + + HistoryPolygonlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryPolygonlocation(m *models.HistoryPolygonlocation) *HistoryPolygonlocationTemplate { + o := &HistoryPolygonlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Filter = func() null.Val[string] { return m.Filter } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } + o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } + o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } + o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } + o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } + o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } + o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Usetype = func() null.Val[string] { return m.Usetype } + o.Waterorigin = func() null.Val[string] { return m.Waterorigin } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryPolygonlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryPool(mods ...HistoryPoolMod) *HistoryPoolTemplate { + return f.NewHistoryPoolWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryPoolWithContext(ctx context.Context, mods ...HistoryPoolMod) *HistoryPoolTemplate { + o := &HistoryPoolTemplate{f: f} + + if f != nil { + f.baseHistoryPoolMods.Apply(ctx, o) + } + + HistoryPoolModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTemplate { + o := &HistoryPoolTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Datesent = func() null.Val[int64] { return m.Datesent } + o.Datetested = func() null.Val[int64] { return m.Datetested } + o.Diseasepos = func() null.Val[string] { return m.Diseasepos } + o.Diseasetested = func() null.Val[string] { return m.Diseasetested } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lab = func() null.Val[string] { return m.Lab } + o.LabID = func() null.Val[string] { return m.LabID } + o.Objectid = func() int32 { return m.Objectid } + o.Poolyear = func() null.Val[int16] { return m.Poolyear } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Sampleid = func() null.Val[string] { return m.Sampleid } + o.Survtech = func() null.Val[string] { return m.Survtech } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Vectorsurvcollectionid = func() null.Val[string] { return m.Vectorsurvcollectionid } + o.Vectorsurvpoolid = func() null.Val[string] { return m.Vectorsurvpoolid } + o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryPoolMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryPooldetail(mods ...HistoryPooldetailMod) *HistoryPooldetailTemplate { + return f.NewHistoryPooldetailWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryPooldetailWithContext(ctx context.Context, mods ...HistoryPooldetailMod) *HistoryPooldetailTemplate { + o := &HistoryPooldetailTemplate{f: f} + + if f != nil { + f.baseHistoryPooldetailMods.Apply(ctx, o) + } + + HistoryPooldetailModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *HistoryPooldetailTemplate { + o := &HistoryPooldetailTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Females = func() null.Val[int16] { return m.Females } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Objectid = func() int32 { return m.Objectid } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryPooldetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryProposedtreatmentarea(mods ...HistoryProposedtreatmentareaMod) *HistoryProposedtreatmentareaTemplate { + return f.NewHistoryProposedtreatmentareaWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryProposedtreatmentareaWithContext(ctx context.Context, mods ...HistoryProposedtreatmentareaMod) *HistoryProposedtreatmentareaTemplate { + o := &HistoryProposedtreatmentareaTemplate{f: f} + + if f != nil { + f.baseHistoryProposedtreatmentareaMods.Apply(ctx, o) + } + + HistoryProposedtreatmentareaModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentarea) *HistoryProposedtreatmentareaTemplate { + o := &HistoryProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Completedby = func() null.Val[string] { return m.Completedby } + o.Completeddate = func() null.Val[int64] { return m.Completeddate } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Duedate = func() null.Val[int64] { return m.Duedate } + o.Exported = func() null.Val[int16] { return m.Exported } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Hectares = func() null.Val[float64] { return m.Hectares } + o.Issprayroute = func() null.Val[int16] { return m.Issprayroute } + o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } + o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } + o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } + o.Method = func() null.Val[string] { return m.Method } + o.Name = func() null.Val[string] { return m.Name } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Targetapprate = func() null.Val[float64] { return m.Targetapprate } + o.Targetproduct = func() null.Val[string] { return m.Targetproduct } + o.Targetspecies = func() null.Val[string] { return m.Targetspecies } + o.Zone = func() null.Val[string] { return m.Zone } + o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryProposedtreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryQamosquitoinspection(mods ...HistoryQamosquitoinspectionMod) *HistoryQamosquitoinspectionTemplate { + return f.NewHistoryQamosquitoinspectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryQamosquitoinspectionWithContext(ctx context.Context, mods ...HistoryQamosquitoinspectionMod) *HistoryQamosquitoinspectionTemplate { + o := &HistoryQamosquitoinspectionTemplate{f: f} + + if f != nil { + f.baseHistoryQamosquitoinspectionMods.Apply(ctx, o) + } + + HistoryQamosquitoinspectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspection) *HistoryQamosquitoinspectionTemplate { + o := &HistoryQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Aquaticorganisms = func() null.Val[string] { return m.Aquaticorganisms } + o.Avetemp = func() null.Val[float64] { return m.Avetemp } + o.Breedingpotential = func() null.Val[string] { return m.Breedingpotential } + 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 } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Fish = func() null.Val[int16] { return m.Fish } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habvalue1 = func() null.Val[int16] { return m.Habvalue1 } + o.Habvalue1percent = func() null.Val[int16] { return m.Habvalue1percent } + o.Habvalue2 = func() null.Val[int16] { return m.Habvalue2 } + o.Habvalue2percent = func() null.Val[int16] { return m.Habvalue2percent } + o.Larvaeinsidetreatedarea = func() null.Val[int16] { return m.Larvaeinsidetreatedarea } + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return m.Larvaeoutsidetreatedarea } + o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } + o.Larvaereason = func() null.Val[string] { return m.Larvaereason } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LR = func() null.Val[int16] { return m.LR } + o.Mosquitohabitat = func() null.Val[string] { return m.Mosquitohabitat } + o.Movingwater = func() null.Val[int16] { return m.Movingwater } + o.Negdips = func() null.Val[int16] { return m.Negdips } + o.Nowaterever = func() null.Val[int16] { return m.Nowaterever } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Posdips = func() null.Val[int16] { return m.Posdips } + o.Potential = func() null.Val[int16] { return m.Potential } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sitetype = func() null.Val[string] { return m.Sitetype } + o.Soilconditions = func() null.Val[string] { return m.Soilconditions } + o.Sourcereduction = func() null.Val[string] { return m.Sourcereduction } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Totalacres = func() null.Val[float64] { return m.Totalacres } + o.Vegetation = func() null.Val[string] { return m.Vegetation } + o.Waterconditions = func() null.Val[string] { return m.Waterconditions } + o.Waterduration = func() null.Val[string] { return m.Waterduration } + o.Watermovement1 = func() null.Val[string] { return m.Watermovement1 } + o.Watermovement1percent = func() null.Val[int16] { return m.Watermovement1percent } + o.Watermovement2 = func() null.Val[string] { return m.Watermovement2 } + o.Watermovement2percent = func() null.Val[int16] { return m.Watermovement2percent } + o.Waterpresent = func() null.Val[int16] { return m.Waterpresent } + o.Watersource = func() null.Val[string] { return m.Watersource } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryQamosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryRodentlocation(mods ...HistoryRodentlocationMod) *HistoryRodentlocationTemplate { + return f.NewHistoryRodentlocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryRodentlocationWithContext(ctx context.Context, mods ...HistoryRodentlocationMod) *HistoryRodentlocationTemplate { + o := &HistoryRodentlocationTemplate{f: f} + + if f != nil { + f.baseHistoryRodentlocationMods.Apply(ctx, o) + } + + HistoryRodentlocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocation) *HistoryRodentlocationTemplate { + o := &HistoryRodentlocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Lastinspectaction = func() null.Val[string] { return m.Lastinspectaction } + o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } + o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } + o.Lastinspectrodentevidence = func() null.Val[string] { return m.Lastinspectrodentevidence } + o.Lastinspectspecies = func() null.Val[string] { return m.Lastinspectspecies } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Symbology = func() null.Val[string] { return m.Symbology } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryRodentlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistorySamplecollection(mods ...HistorySamplecollectionMod) *HistorySamplecollectionTemplate { + return f.NewHistorySamplecollectionWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistorySamplecollectionWithContext(ctx context.Context, mods ...HistorySamplecollectionMod) *HistorySamplecollectionTemplate { + o := &HistorySamplecollectionTemplate{f: f} + + if f != nil { + f.baseHistorySamplecollectionMods.Apply(ctx, o) + } + + HistorySamplecollectionModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecollection) *HistorySamplecollectionTemplate { + o := &HistorySamplecollectionTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + 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 } + o.Datesent = func() null.Val[int64] { return m.Datesent } + o.Datetested = func() null.Val[int64] { return m.Datetested } + o.Diseasepos = func() null.Val[string] { return m.Diseasepos } + o.Diseasetested = func() null.Val[string] { return m.Diseasetested } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Flockid = func() null.Val[string] { return m.Flockid } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lab = func() null.Val[string] { return m.Lab } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LocID = func() null.Val[string] { return m.LocID } + o.Objectid = func() int32 { return m.Objectid } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Samplecond = func() null.Val[string] { return m.Samplecond } + o.Samplecount = func() null.Val[int16] { return m.Samplecount } + o.Sampleid = func() null.Val[string] { return m.Sampleid } + o.Sampletype = func() null.Val[string] { return m.Sampletype } + o.Sex = func() null.Val[string] { return m.Sex } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Species = func() null.Val[string] { return m.Species } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Survtech = func() null.Val[string] { return m.Survtech } + o.Testmethod = func() null.Val[string] { return m.Testmethod } + o.Testtech = func() null.Val[string] { return m.Testtech } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistorySamplecollectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistorySamplelocation(mods ...HistorySamplelocationMod) *HistorySamplelocationTemplate { + return f.NewHistorySamplelocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistorySamplelocationWithContext(ctx context.Context, mods ...HistorySamplelocationMod) *HistorySamplelocationTemplate { + o := &HistorySamplelocationTemplate{f: f} + + if f != nil { + f.baseHistorySamplelocationMods.Apply(ctx, o) + } + + HistorySamplelocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocation) *HistorySamplelocationTemplate { + o := &HistorySamplelocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistorySamplelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryServicerequest(mods ...HistoryServicerequestMod) *HistoryServicerequestTemplate { + return f.NewHistoryServicerequestWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryServicerequestWithContext(ctx context.Context, mods ...HistoryServicerequestMod) *HistoryServicerequestTemplate { + o := &HistoryServicerequestTemplate{f: f} + + if f != nil { + f.baseHistoryServicerequestMods.Apply(ctx, o) + } + + HistoryServicerequestModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequest) *HistoryServicerequestTemplate { + o := &HistoryServicerequestTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Allowed = func() null.Val[string] { return m.Allowed } + o.Assignedtech = func() null.Val[string] { return m.Assignedtech } + o.Clraddr1 = func() null.Val[string] { return m.Clraddr1 } + o.Clraddr2 = func() null.Val[string] { return m.Clraddr2 } + o.Clranon = func() null.Val[int16] { return m.Clranon } + o.Clrcity = func() null.Val[string] { return m.Clrcity } + o.Clrcompany = func() null.Val[string] { return m.Clrcompany } + o.Clrcontpref = func() null.Val[string] { return m.Clrcontpref } + o.Clremail = func() null.Val[string] { return m.Clremail } + o.Clrfname = func() null.Val[string] { return m.Clrfname } + o.Clrother = func() null.Val[string] { return m.Clrother } + o.Clrphone1 = func() null.Val[string] { return m.Clrphone1 } + o.Clrphone2 = func() null.Val[string] { return m.Clrphone2 } + o.Clrstate = func() null.Val[string] { return m.Clrstate } + o.Clrzip = func() null.Val[string] { return m.Clrzip } + 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 } + o.Datetimeclosed = func() null.Val[int64] { return m.Datetimeclosed } + o.Duedate = func() null.Val[int64] { return m.Duedate } + o.Entrytech = func() null.Val[string] { return m.Entrytech } + o.Estcompletedate = func() null.Val[int64] { return m.Estcompletedate } + o.Externalerror = func() null.Val[string] { return m.Externalerror } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Firstresponsedate = func() null.Val[int64] { return m.Firstresponsedate } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Issuesreported = func() null.Val[string] { return m.Issuesreported } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Nextaction = func() null.Val[string] { return m.Nextaction } + o.Notificationtimestamp = func() null.Val[string] { return m.Notificationtimestamp } + o.Notified = func() null.Val[int16] { return m.Notified } + o.Notifieddate = func() null.Val[int64] { return m.Notifieddate } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Priority = func() null.Val[string] { return m.Priority } + o.Recdatetime = func() null.Val[int64] { return m.Recdatetime } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Rejectedby = func() null.Val[string] { return m.Rejectedby } + o.Rejecteddate = func() null.Val[int64] { return m.Rejecteddate } + o.Rejectedreason = func() null.Val[string] { return m.Rejectedreason } + o.Reqaddr1 = func() null.Val[string] { return m.Reqaddr1 } + o.Reqaddr2 = func() null.Val[string] { return m.Reqaddr2 } + o.Reqcity = func() null.Val[string] { return m.Reqcity } + o.Reqcompany = func() null.Val[string] { return m.Reqcompany } + o.Reqcrossst = func() null.Val[string] { return m.Reqcrossst } + o.Reqdescr = func() null.Val[string] { return m.Reqdescr } + o.Reqfldnotes = func() null.Val[string] { return m.Reqfldnotes } + o.Reqmapgrid = func() null.Val[string] { return m.Reqmapgrid } + o.Reqnotesforcust = func() null.Val[string] { return m.Reqnotesforcust } + o.Reqnotesfortech = func() null.Val[string] { return m.Reqnotesfortech } + o.Reqpermission = func() null.Val[int16] { return m.Reqpermission } + o.Reqprogramactions = func() null.Val[string] { return m.Reqprogramactions } + o.Reqstate = func() null.Val[string] { return m.Reqstate } + o.Reqsubdiv = func() null.Val[string] { return m.Reqsubdiv } + o.Reqtarget = func() null.Val[string] { return m.Reqtarget } + o.Reqzip = func() null.Val[string] { return m.Reqzip } + o.Responsedaycount = func() null.Val[int16] { return m.Responsedaycount } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Scheduled = func() null.Val[int16] { return m.Scheduled } + o.Scheduleddate = func() null.Val[int64] { return m.Scheduleddate } + o.Source = func() null.Val[string] { return m.Source } + o.SRNumber = func() null.Val[int64] { return m.SRNumber } + o.Status = func() null.Val[string] { return m.Status } + o.Supervisor = func() null.Val[string] { return m.Supervisor } + o.Techclosed = func() null.Val[string] { return m.Techclosed } + o.Validx = func() null.Val[string] { return m.Validx } + o.Validy = func() null.Val[string] { return m.Validy } + o.Xvalue = func() null.Val[string] { return m.Xvalue } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Dog = func() null.Val[int64] { return m.Dog } + o.Spanish = func() null.Val[int64] { return m.Spanish } + o.ScheduleNotes = func() null.Val[string] { return m.ScheduleNotes } + o.SchedulePeriod = func() null.Val[string] { return m.SchedulePeriod } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryServicerequestMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistorySpeciesabundance(mods ...HistorySpeciesabundanceMod) *HistorySpeciesabundanceTemplate { + return f.NewHistorySpeciesabundanceWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistorySpeciesabundanceWithContext(ctx context.Context, mods ...HistorySpeciesabundanceMod) *HistorySpeciesabundanceTemplate { + o := &HistorySpeciesabundanceTemplate{f: f} + + if f != nil { + f.baseHistorySpeciesabundanceMods.Apply(ctx, o) + } + + HistorySpeciesabundanceModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesabundance) *HistorySpeciesabundanceTemplate { + o := &HistorySpeciesabundanceTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Eggs = func() null.Val[int16] { return m.Eggs } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Females = func() null.Val[int64] { return m.Females } + o.Gravidfem = func() null.Val[int16] { return m.Gravidfem } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Larvae = func() null.Val[int16] { return m.Larvae } + o.Males = func() null.Val[int16] { return m.Males } + o.Objectid = func() int32 { return m.Objectid } + o.Poolstogen = func() null.Val[int16] { return m.Poolstogen } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Pupae = func() null.Val[int16] { return m.Pupae } + o.Species = func() null.Val[string] { return m.Species } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Globalzscore = func() null.Val[float64] { return m.Globalzscore } + o.H3R7 = func() null.Val[string] { return m.H3R7 } + o.H3R8 = func() null.Val[string] { return m.H3R8 } + o.R7score = func() null.Val[float64] { return m.R7score } + o.R8score = func() null.Val[float64] { return m.R8score } + o.Yearweek = func() null.Val[int64] { return m.Yearweek } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistorySpeciesabundanceMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryStormdrain(mods ...HistoryStormdrainMod) *HistoryStormdrainTemplate { + return f.NewHistoryStormdrainWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryStormdrainWithContext(ctx context.Context, mods ...HistoryStormdrainMod) *HistoryStormdrainTemplate { + o := &HistoryStormdrainTemplate{f: f} + + if f != nil { + f.baseHistoryStormdrainMods.Apply(ctx, o) + } + + HistoryStormdrainModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *HistoryStormdrainTemplate { + o := &HistoryStormdrainTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } + o.Lastaction = func() null.Val[string] { return m.Lastaction } + o.Laststatus = func() null.Val[string] { return m.Laststatus } + o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } + o.Nexttreatmentdate = func() null.Val[int64] { return m.Nexttreatmentdate } + o.Objectid = func() int32 { return m.Objectid } + o.Symbology = func() null.Val[string] { return m.Symbology } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryStormdrainMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryTimecard(mods ...HistoryTimecardMod) *HistoryTimecardTemplate { + return f.NewHistoryTimecardWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryTimecardWithContext(ctx context.Context, mods ...HistoryTimecardMod) *HistoryTimecardTemplate { + o := &HistoryTimecardTemplate{f: f} + + if f != nil { + f.baseHistoryTimecardMods.Apply(ctx, o) + } + + HistoryTimecardModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *HistoryTimecardTemplate { + o := &HistoryTimecardTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Equiptype = func() null.Val[string] { return m.Equiptype } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Lclocid = func() null.Val[string] { return m.Lclocid } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Samplelocid = func() null.Val[string] { return m.Samplelocid } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Rodentlocid = func() null.Val[string] { return m.Rodentlocid } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryTimecardMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryTrapdatum(mods ...HistoryTrapdatumMod) *HistoryTrapdatumTemplate { + return f.NewHistoryTrapdatumWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryTrapdatumWithContext(ctx context.Context, mods ...HistoryTrapdatumMod) *HistoryTrapdatumTemplate { + o := &HistoryTrapdatumTemplate{f: f} + + if f != nil { + f.baseHistoryTrapdatumMods.Apply(ctx, o) + } + + HistoryTrapdatumModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *HistoryTrapdatumTemplate { + o := &HistoryTrapdatumTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Field = func() null.Val[int64] { return m.Field } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Idbytech = func() null.Val[string] { return m.Idbytech } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.LocID = func() null.Val[string] { return m.LocID } + o.LR = func() null.Val[int16] { return m.LR } + o.Objectid = func() int32 { return m.Objectid } + o.Processed = func() null.Val[int16] { return m.Processed } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Sortbytech = func() null.Val[string] { return m.Sortbytech } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Trapactivitytype = func() null.Val[string] { return m.Trapactivitytype } + o.Trapcondition = func() null.Val[string] { return m.Trapcondition } + o.Trapnights = func() null.Val[int16] { return m.Trapnights } + o.Traptype = func() null.Val[string] { return m.Traptype } + o.Voltage = func() null.Val[float64] { return m.Voltage } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Lure = func() null.Val[string] { return m.Lure } + o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } + o.Vectorsurvtraplocationid = func() null.Val[string] { return m.Vectorsurvtraplocationid } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryTrapdatumMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryTraplocation(mods ...HistoryTraplocationMod) *HistoryTraplocationTemplate { + return f.NewHistoryTraplocationWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryTraplocationWithContext(ctx context.Context, mods ...HistoryTraplocationMod) *HistoryTraplocationTemplate { + o := &HistoryTraplocationTemplate{f: f} + + if f != nil { + f.baseHistoryTraplocationMods.Apply(ctx, o) + } + + HistoryTraplocationModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation) *HistoryTraplocationTemplate { + o := &HistoryTraplocationTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Description = func() null.Val[string] { return m.Description } + o.Externalid = func() null.Val[string] { return m.Externalid } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } + o.Name = func() null.Val[string] { return m.Name } + o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } + o.Objectid = func() int32 { return m.Objectid } + o.Priority = func() null.Val[string] { return m.Priority } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Route = func() null.Val[int64] { return m.Route } + o.RouteOrder = func() null.Val[int64] { return m.RouteOrder } + o.SetDow = func() null.Val[int64] { return m.SetDow } + o.Vectorsurvsiteid = func() null.Val[string] { return m.Vectorsurvsiteid } + o.H3R7 = func() null.Val[string] { return m.H3R7 } + o.H3R8 = func() null.Val[string] { return m.H3R8 } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryTraplocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryTreatment(mods ...HistoryTreatmentMod) *HistoryTreatmentTemplate { + return f.NewHistoryTreatmentWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryTreatmentWithContext(ctx context.Context, mods ...HistoryTreatmentMod) *HistoryTreatmentTemplate { + o := &HistoryTreatmentTemplate{f: f} + + if f != nil { + f.baseHistoryTreatmentMods.Apply(ctx, o) + } + + HistoryTreatmentModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryTreatment(m *models.HistoryTreatment) *HistoryTreatmentTemplate { + o := &HistoryTreatmentTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Barrierrouteid = func() null.Val[string] { return m.Barrierrouteid } + o.Cbcount = func() null.Val[int16] { return m.Cbcount } + o.Comments = func() null.Val[string] { return m.Comments } + o.Containercount = func() null.Val[int16] { return m.Containercount } + o.Creationdate = func() null.Val[int64] { return m.Creationdate } + o.Creator = func() null.Val[string] { return m.Creator } + o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } + o.Equiptype = func() null.Val[string] { return m.Equiptype } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Fieldtech = func() null.Val[string] { return m.Fieldtech } + o.Flowrate = func() null.Val[float64] { return m.Flowrate } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Habitat = func() null.Val[string] { return m.Habitat } + o.InspID = func() null.Val[string] { return m.InspID } + o.Invloc = func() null.Val[string] { return m.Invloc } + o.Linelocid = func() null.Val[string] { return m.Linelocid } + o.Locationname = func() null.Val[string] { return m.Locationname } + o.Method = func() null.Val[string] { return m.Method } + o.Objectid = func() int32 { return m.Objectid } + o.Pointlocid = func() null.Val[string] { return m.Pointlocid } + o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } + o.Product = func() null.Val[string] { return m.Product } + o.Ptaid = func() null.Val[string] { return m.Ptaid } + o.Qty = func() null.Val[float64] { return m.Qty } + o.Qtyunit = func() null.Val[string] { return m.Qtyunit } + o.Raingauge = func() null.Val[float64] { return m.Raingauge } + o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } + o.Reviewed = func() null.Val[int16] { return m.Reviewed } + o.Reviewedby = func() null.Val[string] { return m.Reviewedby } + o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } + o.Sdid = func() null.Val[string] { return m.Sdid } + o.Sitecond = func() null.Val[string] { return m.Sitecond } + o.Srid = func() null.Val[string] { return m.Srid } + o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } + o.Targetspecies = func() null.Val[string] { return m.Targetspecies } + o.Tirecount = func() null.Val[int16] { return m.Tirecount } + o.Treatacres = func() null.Val[float64] { return m.Treatacres } + o.Treatarea = func() null.Val[float64] { return m.Treatarea } + o.Treathectares = func() null.Val[float64] { return m.Treathectares } + o.Treatmenthours = func() null.Val[float64] { return m.Treatmenthours } + o.Treatmentlength = func() null.Val[float64] { return m.Treatmentlength } + o.Treatmentlengthunits = func() null.Val[string] { return m.Treatmentlengthunits } + o.Totalcostprodcut = func() null.Val[float64] { return m.Totalcostprodcut } + o.Ulvrouteid = func() null.Val[string] { return m.Ulvrouteid } + o.Warningoverride = func() null.Val[int16] { return m.Warningoverride } + o.Winddir = func() null.Val[string] { return m.Winddir } + 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.GeometryX = func() null.Val[float64] { return m.GeometryX } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.TempSitecond = func() null.Val[string] { return m.TempSitecond } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryTreatmentMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryTreatmentarea(mods ...HistoryTreatmentareaMod) *HistoryTreatmentareaTemplate { + return f.NewHistoryTreatmentareaWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryTreatmentareaWithContext(ctx context.Context, mods ...HistoryTreatmentareaMod) *HistoryTreatmentareaTemplate { + o := &HistoryTreatmentareaTemplate{f: f} + + if f != nil { + f.baseHistoryTreatmentareaMods.Apply(ctx, o) + } + + HistoryTreatmentareaModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentarea) *HistoryTreatmentareaTemplate { + o := &HistoryTreatmentareaTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Notified = func() null.Val[int16] { return m.Notified } + o.Objectid = func() int32 { return m.Objectid } + o.SessionID = func() null.Val[string] { return m.SessionID } + o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } + o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryTreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryZone(mods ...HistoryZoneMod) *HistoryZoneTemplate { + return f.NewHistoryZoneWithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryZoneWithContext(ctx context.Context, mods ...HistoryZoneMod) *HistoryZoneTemplate { + o := &HistoryZoneTemplate{f: f} + + if f != nil { + f.baseHistoryZoneMods.Apply(ctx, o) + } + + HistoryZoneModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTemplate { + o := &HistoryZoneTemplate{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editdate = func() null.Val[int64] { return m.Editdate } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Name = func() null.Val[string] { return m.Name } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryZoneMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + +func (f *Factory) NewHistoryZones2(mods ...HistoryZones2Mod) *HistoryZones2Template { + return f.NewHistoryZones2WithContext(context.Background(), mods...) +} + +func (f *Factory) NewHistoryZones2WithContext(ctx context.Context, mods ...HistoryZones2Mod) *HistoryZones2Template { + o := &HistoryZones2Template{f: f} + + if f != nil { + f.baseHistoryZones2Mods.Apply(ctx, o) + } + + HistoryZones2ModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZones2Template { + o := &HistoryZones2Template{f: f, alreadyPersisted: true} + + o.OrganizationID = func() null.Val[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 } + o.Editor = func() null.Val[string] { return m.Editor } + o.Globalid = func() null.Val[string] { return m.Globalid } + o.Name = func() null.Val[string] { return m.Name } + 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.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 } + o.GeometryY = func() null.Val[float64] { return m.GeometryY } + o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } + o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } + o.Version = func() int32 { return m.Version } + + ctx := context.Background() + if m.R.Organization != nil { + HistoryZones2Mods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + func (f *Factory) NewOauthToken(mods ...OauthTokenMod) *OauthTokenTemplate { return f.NewOauthTokenWithContext(context.Background(), mods...) } @@ -111,8 +3591,171 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization o.Name = func() null.Val[string] { return m.Name } o.ArcgisID = func() null.Val[string] { return m.ArcgisID } o.ArcgisName = func() null.Val[string] { return m.ArcgisName } + o.FieldseekerURL = func() null.Val[string] { return m.FieldseekerURL } ctx := context.Background() + if len(m.R.FSContainerrelates) > 0 { + OrganizationMods.AddExistingFSContainerrelates(m.R.FSContainerrelates...).Apply(ctx, o) + } + if len(m.R.FSFieldscoutinglogs) > 0 { + OrganizationMods.AddExistingFSFieldscoutinglogs(m.R.FSFieldscoutinglogs...).Apply(ctx, o) + } + if len(m.R.FSHabitatrelates) > 0 { + OrganizationMods.AddExistingFSHabitatrelates(m.R.FSHabitatrelates...).Apply(ctx, o) + } + if len(m.R.FSInspectionsamples) > 0 { + OrganizationMods.AddExistingFSInspectionsamples(m.R.FSInspectionsamples...).Apply(ctx, o) + } + if len(m.R.FSInspectionsampledetails) > 0 { + OrganizationMods.AddExistingFSInspectionsampledetails(m.R.FSInspectionsampledetails...).Apply(ctx, o) + } + if len(m.R.FSLinelocations) > 0 { + OrganizationMods.AddExistingFSLinelocations(m.R.FSLinelocations...).Apply(ctx, o) + } + if len(m.R.FSLocationtrackings) > 0 { + OrganizationMods.AddExistingFSLocationtrackings(m.R.FSLocationtrackings...).Apply(ctx, o) + } + if len(m.R.FSMosquitoinspections) > 0 { + OrganizationMods.AddExistingFSMosquitoinspections(m.R.FSMosquitoinspections...).Apply(ctx, o) + } + if len(m.R.FSPointlocations) > 0 { + OrganizationMods.AddExistingFSPointlocations(m.R.FSPointlocations...).Apply(ctx, o) + } + if len(m.R.FSPolygonlocations) > 0 { + OrganizationMods.AddExistingFSPolygonlocations(m.R.FSPolygonlocations...).Apply(ctx, o) + } + if len(m.R.FSPools) > 0 { + OrganizationMods.AddExistingFSPools(m.R.FSPools...).Apply(ctx, o) + } + if len(m.R.FSPooldetails) > 0 { + OrganizationMods.AddExistingFSPooldetails(m.R.FSPooldetails...).Apply(ctx, o) + } + if len(m.R.FSProposedtreatmentareas) > 0 { + OrganizationMods.AddExistingFSProposedtreatmentareas(m.R.FSProposedtreatmentareas...).Apply(ctx, o) + } + if len(m.R.FSQamosquitoinspections) > 0 { + OrganizationMods.AddExistingFSQamosquitoinspections(m.R.FSQamosquitoinspections...).Apply(ctx, o) + } + if len(m.R.FSRodentlocations) > 0 { + OrganizationMods.AddExistingFSRodentlocations(m.R.FSRodentlocations...).Apply(ctx, o) + } + if len(m.R.FSSamplecollections) > 0 { + OrganizationMods.AddExistingFSSamplecollections(m.R.FSSamplecollections...).Apply(ctx, o) + } + if len(m.R.FSSamplelocations) > 0 { + OrganizationMods.AddExistingFSSamplelocations(m.R.FSSamplelocations...).Apply(ctx, o) + } + if len(m.R.FSServicerequests) > 0 { + OrganizationMods.AddExistingFSServicerequests(m.R.FSServicerequests...).Apply(ctx, o) + } + if len(m.R.FSSpeciesabundances) > 0 { + OrganizationMods.AddExistingFSSpeciesabundances(m.R.FSSpeciesabundances...).Apply(ctx, o) + } + if len(m.R.FSStormdrains) > 0 { + OrganizationMods.AddExistingFSStormdrains(m.R.FSStormdrains...).Apply(ctx, o) + } + if len(m.R.FSTimecards) > 0 { + OrganizationMods.AddExistingFSTimecards(m.R.FSTimecards...).Apply(ctx, o) + } + if len(m.R.FSTrapdata) > 0 { + OrganizationMods.AddExistingFSTrapdata(m.R.FSTrapdata...).Apply(ctx, o) + } + if len(m.R.FSTraplocations) > 0 { + OrganizationMods.AddExistingFSTraplocations(m.R.FSTraplocations...).Apply(ctx, o) + } + if len(m.R.FSTreatments) > 0 { + OrganizationMods.AddExistingFSTreatments(m.R.FSTreatments...).Apply(ctx, o) + } + if len(m.R.FSTreatmentareas) > 0 { + OrganizationMods.AddExistingFSTreatmentareas(m.R.FSTreatmentareas...).Apply(ctx, o) + } + if len(m.R.FSZones) > 0 { + OrganizationMods.AddExistingFSZones(m.R.FSZones...).Apply(ctx, o) + } + if len(m.R.FSZones2s) > 0 { + OrganizationMods.AddExistingFSZones2s(m.R.FSZones2s...).Apply(ctx, o) + } + if len(m.R.HistoryContainerrelates) > 0 { + OrganizationMods.AddExistingHistoryContainerrelates(m.R.HistoryContainerrelates...).Apply(ctx, o) + } + if len(m.R.HistoryFieldscoutinglogs) > 0 { + OrganizationMods.AddExistingHistoryFieldscoutinglogs(m.R.HistoryFieldscoutinglogs...).Apply(ctx, o) + } + if len(m.R.HistoryHabitatrelates) > 0 { + OrganizationMods.AddExistingHistoryHabitatrelates(m.R.HistoryHabitatrelates...).Apply(ctx, o) + } + if len(m.R.HistoryInspectionsamples) > 0 { + OrganizationMods.AddExistingHistoryInspectionsamples(m.R.HistoryInspectionsamples...).Apply(ctx, o) + } + if len(m.R.HistoryInspectionsampledetails) > 0 { + OrganizationMods.AddExistingHistoryInspectionsampledetails(m.R.HistoryInspectionsampledetails...).Apply(ctx, o) + } + if len(m.R.HistoryLinelocations) > 0 { + OrganizationMods.AddExistingHistoryLinelocations(m.R.HistoryLinelocations...).Apply(ctx, o) + } + if len(m.R.HistoryLocationtrackings) > 0 { + OrganizationMods.AddExistingHistoryLocationtrackings(m.R.HistoryLocationtrackings...).Apply(ctx, o) + } + if len(m.R.HistoryMosquitoinspections) > 0 { + OrganizationMods.AddExistingHistoryMosquitoinspections(m.R.HistoryMosquitoinspections...).Apply(ctx, o) + } + if len(m.R.HistoryPointlocations) > 0 { + OrganizationMods.AddExistingHistoryPointlocations(m.R.HistoryPointlocations...).Apply(ctx, o) + } + if len(m.R.HistoryPolygonlocations) > 0 { + OrganizationMods.AddExistingHistoryPolygonlocations(m.R.HistoryPolygonlocations...).Apply(ctx, o) + } + if len(m.R.HistoryPools) > 0 { + OrganizationMods.AddExistingHistoryPools(m.R.HistoryPools...).Apply(ctx, o) + } + if len(m.R.HistoryPooldetails) > 0 { + OrganizationMods.AddExistingHistoryPooldetails(m.R.HistoryPooldetails...).Apply(ctx, o) + } + if len(m.R.HistoryProposedtreatmentareas) > 0 { + OrganizationMods.AddExistingHistoryProposedtreatmentareas(m.R.HistoryProposedtreatmentareas...).Apply(ctx, o) + } + if len(m.R.HistoryQamosquitoinspections) > 0 { + OrganizationMods.AddExistingHistoryQamosquitoinspections(m.R.HistoryQamosquitoinspections...).Apply(ctx, o) + } + if len(m.R.HistoryRodentlocations) > 0 { + OrganizationMods.AddExistingHistoryRodentlocations(m.R.HistoryRodentlocations...).Apply(ctx, o) + } + if len(m.R.HistorySamplecollections) > 0 { + OrganizationMods.AddExistingHistorySamplecollections(m.R.HistorySamplecollections...).Apply(ctx, o) + } + if len(m.R.HistorySamplelocations) > 0 { + OrganizationMods.AddExistingHistorySamplelocations(m.R.HistorySamplelocations...).Apply(ctx, o) + } + if len(m.R.HistoryServicerequests) > 0 { + OrganizationMods.AddExistingHistoryServicerequests(m.R.HistoryServicerequests...).Apply(ctx, o) + } + if len(m.R.HistorySpeciesabundances) > 0 { + OrganizationMods.AddExistingHistorySpeciesabundances(m.R.HistorySpeciesabundances...).Apply(ctx, o) + } + if len(m.R.HistoryStormdrains) > 0 { + OrganizationMods.AddExistingHistoryStormdrains(m.R.HistoryStormdrains...).Apply(ctx, o) + } + if len(m.R.HistoryTimecards) > 0 { + OrganizationMods.AddExistingHistoryTimecards(m.R.HistoryTimecards...).Apply(ctx, o) + } + if len(m.R.HistoryTrapdata) > 0 { + OrganizationMods.AddExistingHistoryTrapdata(m.R.HistoryTrapdata...).Apply(ctx, o) + } + if len(m.R.HistoryTraplocations) > 0 { + OrganizationMods.AddExistingHistoryTraplocations(m.R.HistoryTraplocations...).Apply(ctx, o) + } + if len(m.R.HistoryTreatments) > 0 { + OrganizationMods.AddExistingHistoryTreatments(m.R.HistoryTreatments...).Apply(ctx, o) + } + if len(m.R.HistoryTreatmentareas) > 0 { + OrganizationMods.AddExistingHistoryTreatmentareas(m.R.HistoryTreatmentareas...).Apply(ctx, o) + } + if len(m.R.HistoryZones) > 0 { + OrganizationMods.AddExistingHistoryZones(m.R.HistoryZones...).Apply(ctx, o) + } + if len(m.R.HistoryZones2s) > 0 { + OrganizationMods.AddExistingHistoryZones2s(m.R.HistoryZones2s...).Apply(ctx, o) + } if len(m.R.User) > 0 { OrganizationMods.AddExistingUser(m.R.User...).Apply(ctx, o) } @@ -189,6 +3832,222 @@ func (f *Factory) FromExistingUser(m *models.User) *UserTemplate { return o } +func (f *Factory) ClearBaseFSContainerrelateMods() { + f.baseFSContainerrelateMods = nil +} + +func (f *Factory) AddBaseFSContainerrelateMod(mods ...FSContainerrelateMod) { + f.baseFSContainerrelateMods = append(f.baseFSContainerrelateMods, mods...) +} + +func (f *Factory) ClearBaseFSFieldscoutinglogMods() { + f.baseFSFieldscoutinglogMods = nil +} + +func (f *Factory) AddBaseFSFieldscoutinglogMod(mods ...FSFieldscoutinglogMod) { + f.baseFSFieldscoutinglogMods = append(f.baseFSFieldscoutinglogMods, mods...) +} + +func (f *Factory) ClearBaseFSHabitatrelateMods() { + f.baseFSHabitatrelateMods = nil +} + +func (f *Factory) AddBaseFSHabitatrelateMod(mods ...FSHabitatrelateMod) { + f.baseFSHabitatrelateMods = append(f.baseFSHabitatrelateMods, mods...) +} + +func (f *Factory) ClearBaseFSInspectionsampleMods() { + f.baseFSInspectionsampleMods = nil +} + +func (f *Factory) AddBaseFSInspectionsampleMod(mods ...FSInspectionsampleMod) { + f.baseFSInspectionsampleMods = append(f.baseFSInspectionsampleMods, mods...) +} + +func (f *Factory) ClearBaseFSInspectionsampledetailMods() { + f.baseFSInspectionsampledetailMods = nil +} + +func (f *Factory) AddBaseFSInspectionsampledetailMod(mods ...FSInspectionsampledetailMod) { + f.baseFSInspectionsampledetailMods = append(f.baseFSInspectionsampledetailMods, mods...) +} + +func (f *Factory) ClearBaseFSLinelocationMods() { + f.baseFSLinelocationMods = nil +} + +func (f *Factory) AddBaseFSLinelocationMod(mods ...FSLinelocationMod) { + f.baseFSLinelocationMods = append(f.baseFSLinelocationMods, mods...) +} + +func (f *Factory) ClearBaseFSLocationtrackingMods() { + f.baseFSLocationtrackingMods = nil +} + +func (f *Factory) AddBaseFSLocationtrackingMod(mods ...FSLocationtrackingMod) { + f.baseFSLocationtrackingMods = append(f.baseFSLocationtrackingMods, mods...) +} + +func (f *Factory) ClearBaseFSMosquitoinspectionMods() { + f.baseFSMosquitoinspectionMods = nil +} + +func (f *Factory) AddBaseFSMosquitoinspectionMod(mods ...FSMosquitoinspectionMod) { + f.baseFSMosquitoinspectionMods = append(f.baseFSMosquitoinspectionMods, mods...) +} + +func (f *Factory) ClearBaseFSPointlocationMods() { + f.baseFSPointlocationMods = nil +} + +func (f *Factory) AddBaseFSPointlocationMod(mods ...FSPointlocationMod) { + f.baseFSPointlocationMods = append(f.baseFSPointlocationMods, mods...) +} + +func (f *Factory) ClearBaseFSPolygonlocationMods() { + f.baseFSPolygonlocationMods = nil +} + +func (f *Factory) AddBaseFSPolygonlocationMod(mods ...FSPolygonlocationMod) { + f.baseFSPolygonlocationMods = append(f.baseFSPolygonlocationMods, mods...) +} + +func (f *Factory) ClearBaseFSPoolMods() { + f.baseFSPoolMods = nil +} + +func (f *Factory) AddBaseFSPoolMod(mods ...FSPoolMod) { + f.baseFSPoolMods = append(f.baseFSPoolMods, mods...) +} + +func (f *Factory) ClearBaseFSPooldetailMods() { + f.baseFSPooldetailMods = nil +} + +func (f *Factory) AddBaseFSPooldetailMod(mods ...FSPooldetailMod) { + f.baseFSPooldetailMods = append(f.baseFSPooldetailMods, mods...) +} + +func (f *Factory) ClearBaseFSProposedtreatmentareaMods() { + f.baseFSProposedtreatmentareaMods = nil +} + +func (f *Factory) AddBaseFSProposedtreatmentareaMod(mods ...FSProposedtreatmentareaMod) { + f.baseFSProposedtreatmentareaMods = append(f.baseFSProposedtreatmentareaMods, mods...) +} + +func (f *Factory) ClearBaseFSQamosquitoinspectionMods() { + f.baseFSQamosquitoinspectionMods = nil +} + +func (f *Factory) AddBaseFSQamosquitoinspectionMod(mods ...FSQamosquitoinspectionMod) { + f.baseFSQamosquitoinspectionMods = append(f.baseFSQamosquitoinspectionMods, mods...) +} + +func (f *Factory) ClearBaseFSRodentlocationMods() { + f.baseFSRodentlocationMods = nil +} + +func (f *Factory) AddBaseFSRodentlocationMod(mods ...FSRodentlocationMod) { + f.baseFSRodentlocationMods = append(f.baseFSRodentlocationMods, mods...) +} + +func (f *Factory) ClearBaseFSSamplecollectionMods() { + f.baseFSSamplecollectionMods = nil +} + +func (f *Factory) AddBaseFSSamplecollectionMod(mods ...FSSamplecollectionMod) { + f.baseFSSamplecollectionMods = append(f.baseFSSamplecollectionMods, mods...) +} + +func (f *Factory) ClearBaseFSSamplelocationMods() { + f.baseFSSamplelocationMods = nil +} + +func (f *Factory) AddBaseFSSamplelocationMod(mods ...FSSamplelocationMod) { + f.baseFSSamplelocationMods = append(f.baseFSSamplelocationMods, mods...) +} + +func (f *Factory) ClearBaseFSServicerequestMods() { + f.baseFSServicerequestMods = nil +} + +func (f *Factory) AddBaseFSServicerequestMod(mods ...FSServicerequestMod) { + f.baseFSServicerequestMods = append(f.baseFSServicerequestMods, mods...) +} + +func (f *Factory) ClearBaseFSSpeciesabundanceMods() { + f.baseFSSpeciesabundanceMods = nil +} + +func (f *Factory) AddBaseFSSpeciesabundanceMod(mods ...FSSpeciesabundanceMod) { + f.baseFSSpeciesabundanceMods = append(f.baseFSSpeciesabundanceMods, mods...) +} + +func (f *Factory) ClearBaseFSStormdrainMods() { + f.baseFSStormdrainMods = nil +} + +func (f *Factory) AddBaseFSStormdrainMod(mods ...FSStormdrainMod) { + f.baseFSStormdrainMods = append(f.baseFSStormdrainMods, mods...) +} + +func (f *Factory) ClearBaseFSTimecardMods() { + f.baseFSTimecardMods = nil +} + +func (f *Factory) AddBaseFSTimecardMod(mods ...FSTimecardMod) { + f.baseFSTimecardMods = append(f.baseFSTimecardMods, mods...) +} + +func (f *Factory) ClearBaseFSTrapdatumMods() { + f.baseFSTrapdatumMods = nil +} + +func (f *Factory) AddBaseFSTrapdatumMod(mods ...FSTrapdatumMod) { + f.baseFSTrapdatumMods = append(f.baseFSTrapdatumMods, mods...) +} + +func (f *Factory) ClearBaseFSTraplocationMods() { + f.baseFSTraplocationMods = nil +} + +func (f *Factory) AddBaseFSTraplocationMod(mods ...FSTraplocationMod) { + f.baseFSTraplocationMods = append(f.baseFSTraplocationMods, mods...) +} + +func (f *Factory) ClearBaseFSTreatmentMods() { + f.baseFSTreatmentMods = nil +} + +func (f *Factory) AddBaseFSTreatmentMod(mods ...FSTreatmentMod) { + f.baseFSTreatmentMods = append(f.baseFSTreatmentMods, mods...) +} + +func (f *Factory) ClearBaseFSTreatmentareaMods() { + f.baseFSTreatmentareaMods = nil +} + +func (f *Factory) AddBaseFSTreatmentareaMod(mods ...FSTreatmentareaMod) { + f.baseFSTreatmentareaMods = append(f.baseFSTreatmentareaMods, mods...) +} + +func (f *Factory) ClearBaseFSZoneMods() { + f.baseFSZoneMods = nil +} + +func (f *Factory) AddBaseFSZoneMod(mods ...FSZoneMod) { + f.baseFSZoneMods = append(f.baseFSZoneMods, mods...) +} + +func (f *Factory) ClearBaseFSZones2Mods() { + f.baseFSZones2Mods = nil +} + +func (f *Factory) AddBaseFSZones2Mod(mods ...FSZones2Mod) { + f.baseFSZones2Mods = append(f.baseFSZones2Mods, mods...) +} + func (f *Factory) ClearBaseGooseDBVersionMods() { f.baseGooseDBVersionMods = nil } @@ -197,6 +4056,222 @@ func (f *Factory) AddBaseGooseDBVersionMod(mods ...GooseDBVersionMod) { f.baseGooseDBVersionMods = append(f.baseGooseDBVersionMods, mods...) } +func (f *Factory) ClearBaseHistoryContainerrelateMods() { + f.baseHistoryContainerrelateMods = nil +} + +func (f *Factory) AddBaseHistoryContainerrelateMod(mods ...HistoryContainerrelateMod) { + f.baseHistoryContainerrelateMods = append(f.baseHistoryContainerrelateMods, mods...) +} + +func (f *Factory) ClearBaseHistoryFieldscoutinglogMods() { + f.baseHistoryFieldscoutinglogMods = nil +} + +func (f *Factory) AddBaseHistoryFieldscoutinglogMod(mods ...HistoryFieldscoutinglogMod) { + f.baseHistoryFieldscoutinglogMods = append(f.baseHistoryFieldscoutinglogMods, mods...) +} + +func (f *Factory) ClearBaseHistoryHabitatrelateMods() { + f.baseHistoryHabitatrelateMods = nil +} + +func (f *Factory) AddBaseHistoryHabitatrelateMod(mods ...HistoryHabitatrelateMod) { + f.baseHistoryHabitatrelateMods = append(f.baseHistoryHabitatrelateMods, mods...) +} + +func (f *Factory) ClearBaseHistoryInspectionsampleMods() { + f.baseHistoryInspectionsampleMods = nil +} + +func (f *Factory) AddBaseHistoryInspectionsampleMod(mods ...HistoryInspectionsampleMod) { + f.baseHistoryInspectionsampleMods = append(f.baseHistoryInspectionsampleMods, mods...) +} + +func (f *Factory) ClearBaseHistoryInspectionsampledetailMods() { + f.baseHistoryInspectionsampledetailMods = nil +} + +func (f *Factory) AddBaseHistoryInspectionsampledetailMod(mods ...HistoryInspectionsampledetailMod) { + f.baseHistoryInspectionsampledetailMods = append(f.baseHistoryInspectionsampledetailMods, mods...) +} + +func (f *Factory) ClearBaseHistoryLinelocationMods() { + f.baseHistoryLinelocationMods = nil +} + +func (f *Factory) AddBaseHistoryLinelocationMod(mods ...HistoryLinelocationMod) { + f.baseHistoryLinelocationMods = append(f.baseHistoryLinelocationMods, mods...) +} + +func (f *Factory) ClearBaseHistoryLocationtrackingMods() { + f.baseHistoryLocationtrackingMods = nil +} + +func (f *Factory) AddBaseHistoryLocationtrackingMod(mods ...HistoryLocationtrackingMod) { + f.baseHistoryLocationtrackingMods = append(f.baseHistoryLocationtrackingMods, mods...) +} + +func (f *Factory) ClearBaseHistoryMosquitoinspectionMods() { + f.baseHistoryMosquitoinspectionMods = nil +} + +func (f *Factory) AddBaseHistoryMosquitoinspectionMod(mods ...HistoryMosquitoinspectionMod) { + f.baseHistoryMosquitoinspectionMods = append(f.baseHistoryMosquitoinspectionMods, mods...) +} + +func (f *Factory) ClearBaseHistoryPointlocationMods() { + f.baseHistoryPointlocationMods = nil +} + +func (f *Factory) AddBaseHistoryPointlocationMod(mods ...HistoryPointlocationMod) { + f.baseHistoryPointlocationMods = append(f.baseHistoryPointlocationMods, mods...) +} + +func (f *Factory) ClearBaseHistoryPolygonlocationMods() { + f.baseHistoryPolygonlocationMods = nil +} + +func (f *Factory) AddBaseHistoryPolygonlocationMod(mods ...HistoryPolygonlocationMod) { + f.baseHistoryPolygonlocationMods = append(f.baseHistoryPolygonlocationMods, mods...) +} + +func (f *Factory) ClearBaseHistoryPoolMods() { + f.baseHistoryPoolMods = nil +} + +func (f *Factory) AddBaseHistoryPoolMod(mods ...HistoryPoolMod) { + f.baseHistoryPoolMods = append(f.baseHistoryPoolMods, mods...) +} + +func (f *Factory) ClearBaseHistoryPooldetailMods() { + f.baseHistoryPooldetailMods = nil +} + +func (f *Factory) AddBaseHistoryPooldetailMod(mods ...HistoryPooldetailMod) { + f.baseHistoryPooldetailMods = append(f.baseHistoryPooldetailMods, mods...) +} + +func (f *Factory) ClearBaseHistoryProposedtreatmentareaMods() { + f.baseHistoryProposedtreatmentareaMods = nil +} + +func (f *Factory) AddBaseHistoryProposedtreatmentareaMod(mods ...HistoryProposedtreatmentareaMod) { + f.baseHistoryProposedtreatmentareaMods = append(f.baseHistoryProposedtreatmentareaMods, mods...) +} + +func (f *Factory) ClearBaseHistoryQamosquitoinspectionMods() { + f.baseHistoryQamosquitoinspectionMods = nil +} + +func (f *Factory) AddBaseHistoryQamosquitoinspectionMod(mods ...HistoryQamosquitoinspectionMod) { + f.baseHistoryQamosquitoinspectionMods = append(f.baseHistoryQamosquitoinspectionMods, mods...) +} + +func (f *Factory) ClearBaseHistoryRodentlocationMods() { + f.baseHistoryRodentlocationMods = nil +} + +func (f *Factory) AddBaseHistoryRodentlocationMod(mods ...HistoryRodentlocationMod) { + f.baseHistoryRodentlocationMods = append(f.baseHistoryRodentlocationMods, mods...) +} + +func (f *Factory) ClearBaseHistorySamplecollectionMods() { + f.baseHistorySamplecollectionMods = nil +} + +func (f *Factory) AddBaseHistorySamplecollectionMod(mods ...HistorySamplecollectionMod) { + f.baseHistorySamplecollectionMods = append(f.baseHistorySamplecollectionMods, mods...) +} + +func (f *Factory) ClearBaseHistorySamplelocationMods() { + f.baseHistorySamplelocationMods = nil +} + +func (f *Factory) AddBaseHistorySamplelocationMod(mods ...HistorySamplelocationMod) { + f.baseHistorySamplelocationMods = append(f.baseHistorySamplelocationMods, mods...) +} + +func (f *Factory) ClearBaseHistoryServicerequestMods() { + f.baseHistoryServicerequestMods = nil +} + +func (f *Factory) AddBaseHistoryServicerequestMod(mods ...HistoryServicerequestMod) { + f.baseHistoryServicerequestMods = append(f.baseHistoryServicerequestMods, mods...) +} + +func (f *Factory) ClearBaseHistorySpeciesabundanceMods() { + f.baseHistorySpeciesabundanceMods = nil +} + +func (f *Factory) AddBaseHistorySpeciesabundanceMod(mods ...HistorySpeciesabundanceMod) { + f.baseHistorySpeciesabundanceMods = append(f.baseHistorySpeciesabundanceMods, mods...) +} + +func (f *Factory) ClearBaseHistoryStormdrainMods() { + f.baseHistoryStormdrainMods = nil +} + +func (f *Factory) AddBaseHistoryStormdrainMod(mods ...HistoryStormdrainMod) { + f.baseHistoryStormdrainMods = append(f.baseHistoryStormdrainMods, mods...) +} + +func (f *Factory) ClearBaseHistoryTimecardMods() { + f.baseHistoryTimecardMods = nil +} + +func (f *Factory) AddBaseHistoryTimecardMod(mods ...HistoryTimecardMod) { + f.baseHistoryTimecardMods = append(f.baseHistoryTimecardMods, mods...) +} + +func (f *Factory) ClearBaseHistoryTrapdatumMods() { + f.baseHistoryTrapdatumMods = nil +} + +func (f *Factory) AddBaseHistoryTrapdatumMod(mods ...HistoryTrapdatumMod) { + f.baseHistoryTrapdatumMods = append(f.baseHistoryTrapdatumMods, mods...) +} + +func (f *Factory) ClearBaseHistoryTraplocationMods() { + f.baseHistoryTraplocationMods = nil +} + +func (f *Factory) AddBaseHistoryTraplocationMod(mods ...HistoryTraplocationMod) { + f.baseHistoryTraplocationMods = append(f.baseHistoryTraplocationMods, mods...) +} + +func (f *Factory) ClearBaseHistoryTreatmentMods() { + f.baseHistoryTreatmentMods = nil +} + +func (f *Factory) AddBaseHistoryTreatmentMod(mods ...HistoryTreatmentMod) { + f.baseHistoryTreatmentMods = append(f.baseHistoryTreatmentMods, mods...) +} + +func (f *Factory) ClearBaseHistoryTreatmentareaMods() { + f.baseHistoryTreatmentareaMods = nil +} + +func (f *Factory) AddBaseHistoryTreatmentareaMod(mods ...HistoryTreatmentareaMod) { + f.baseHistoryTreatmentareaMods = append(f.baseHistoryTreatmentareaMods, mods...) +} + +func (f *Factory) ClearBaseHistoryZoneMods() { + f.baseHistoryZoneMods = nil +} + +func (f *Factory) AddBaseHistoryZoneMod(mods ...HistoryZoneMod) { + f.baseHistoryZoneMods = append(f.baseHistoryZoneMods, mods...) +} + +func (f *Factory) ClearBaseHistoryZones2Mods() { + f.baseHistoryZones2Mods = nil +} + +func (f *Factory) AddBaseHistoryZones2Mod(mods ...HistoryZones2Mod) { + f.baseHistoryZones2Mods = append(f.baseHistoryZones2Mods, mods...) +} + func (f *Factory) ClearBaseOauthTokenMods() { f.baseOauthTokenMods = nil } diff --git a/factory/bobfactory_main.bob_test.go b/factory/bobfactory_main.bob_test.go index 0001ac1c..93ebb148 100644 --- a/factory/bobfactory_main.bob_test.go +++ b/factory/bobfactory_main.bob_test.go @@ -8,6 +8,654 @@ import ( "testing" ) +func TestCreateFSContainerrelate(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().NewFSContainerrelateWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSContainerrelate: %v", err) + } +} + +func TestCreateFSFieldscoutinglog(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().NewFSFieldscoutinglogWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSFieldscoutinglog: %v", err) + } +} + +func TestCreateFSHabitatrelate(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().NewFSHabitatrelateWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSHabitatrelate: %v", err) + } +} + +func TestCreateFSInspectionsample(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().NewFSInspectionsampleWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSInspectionsample: %v", err) + } +} + +func TestCreateFSInspectionsampledetail(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().NewFSInspectionsampledetailWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSInspectionsampledetail: %v", err) + } +} + +func TestCreateFSLinelocation(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().NewFSLinelocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSLinelocation: %v", err) + } +} + +func TestCreateFSLocationtracking(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().NewFSLocationtrackingWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSLocationtracking: %v", err) + } +} + +func TestCreateFSMosquitoinspection(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().NewFSMosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSMosquitoinspection: %v", err) + } +} + +func TestCreateFSPointlocation(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().NewFSPointlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSPointlocation: %v", err) + } +} + +func TestCreateFSPolygonlocation(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().NewFSPolygonlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSPolygonlocation: %v", err) + } +} + +func TestCreateFSPool(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().NewFSPoolWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSPool: %v", err) + } +} + +func TestCreateFSPooldetail(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().NewFSPooldetailWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSPooldetail: %v", err) + } +} + +func TestCreateFSProposedtreatmentarea(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().NewFSProposedtreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSProposedtreatmentarea: %v", err) + } +} + +func TestCreateFSQamosquitoinspection(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().NewFSQamosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSQamosquitoinspection: %v", err) + } +} + +func TestCreateFSRodentlocation(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().NewFSRodentlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSRodentlocation: %v", err) + } +} + +func TestCreateFSSamplecollection(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().NewFSSamplecollectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSSamplecollection: %v", err) + } +} + +func TestCreateFSSamplelocation(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().NewFSSamplelocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSSamplelocation: %v", err) + } +} + +func TestCreateFSServicerequest(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().NewFSServicerequestWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSServicerequest: %v", err) + } +} + +func TestCreateFSSpeciesabundance(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().NewFSSpeciesabundanceWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSSpeciesabundance: %v", err) + } +} + +func TestCreateFSStormdrain(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().NewFSStormdrainWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSStormdrain: %v", err) + } +} + +func TestCreateFSTimecard(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().NewFSTimecardWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSTimecard: %v", err) + } +} + +func TestCreateFSTrapdatum(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().NewFSTrapdatumWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSTrapdatum: %v", err) + } +} + +func TestCreateFSTraplocation(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().NewFSTraplocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSTraplocation: %v", err) + } +} + +func TestCreateFSTreatment(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().NewFSTreatmentWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSTreatment: %v", err) + } +} + +func TestCreateFSTreatmentarea(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().NewFSTreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSTreatmentarea: %v", err) + } +} + +func TestCreateFSZone(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().NewFSZoneWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSZone: %v", err) + } +} + +func TestCreateFSZones2(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().NewFSZones2WithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FSZones2: %v", err) + } +} + func TestCreateGooseDBVersion(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") @@ -32,6 +680,654 @@ func TestCreateGooseDBVersion(t *testing.T) { } } +func TestCreateHistoryContainerrelate(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().NewHistoryContainerrelateWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryContainerrelate: %v", err) + } +} + +func TestCreateHistoryFieldscoutinglog(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().NewHistoryFieldscoutinglogWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryFieldscoutinglog: %v", err) + } +} + +func TestCreateHistoryHabitatrelate(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().NewHistoryHabitatrelateWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryHabitatrelate: %v", err) + } +} + +func TestCreateHistoryInspectionsample(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().NewHistoryInspectionsampleWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryInspectionsample: %v", err) + } +} + +func TestCreateHistoryInspectionsampledetail(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().NewHistoryInspectionsampledetailWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryInspectionsampledetail: %v", err) + } +} + +func TestCreateHistoryLinelocation(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().NewHistoryLinelocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryLinelocation: %v", err) + } +} + +func TestCreateHistoryLocationtracking(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().NewHistoryLocationtrackingWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryLocationtracking: %v", err) + } +} + +func TestCreateHistoryMosquitoinspection(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().NewHistoryMosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryMosquitoinspection: %v", err) + } +} + +func TestCreateHistoryPointlocation(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().NewHistoryPointlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryPointlocation: %v", err) + } +} + +func TestCreateHistoryPolygonlocation(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().NewHistoryPolygonlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryPolygonlocation: %v", err) + } +} + +func TestCreateHistoryPool(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().NewHistoryPoolWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryPool: %v", err) + } +} + +func TestCreateHistoryPooldetail(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().NewHistoryPooldetailWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryPooldetail: %v", err) + } +} + +func TestCreateHistoryProposedtreatmentarea(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().NewHistoryProposedtreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryProposedtreatmentarea: %v", err) + } +} + +func TestCreateHistoryQamosquitoinspection(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().NewHistoryQamosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryQamosquitoinspection: %v", err) + } +} + +func TestCreateHistoryRodentlocation(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().NewHistoryRodentlocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryRodentlocation: %v", err) + } +} + +func TestCreateHistorySamplecollection(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().NewHistorySamplecollectionWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistorySamplecollection: %v", err) + } +} + +func TestCreateHistorySamplelocation(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().NewHistorySamplelocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistorySamplelocation: %v", err) + } +} + +func TestCreateHistoryServicerequest(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().NewHistoryServicerequestWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryServicerequest: %v", err) + } +} + +func TestCreateHistorySpeciesabundance(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().NewHistorySpeciesabundanceWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistorySpeciesabundance: %v", err) + } +} + +func TestCreateHistoryStormdrain(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().NewHistoryStormdrainWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryStormdrain: %v", err) + } +} + +func TestCreateHistoryTimecard(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().NewHistoryTimecardWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryTimecard: %v", err) + } +} + +func TestCreateHistoryTrapdatum(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().NewHistoryTrapdatumWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryTrapdatum: %v", err) + } +} + +func TestCreateHistoryTraplocation(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().NewHistoryTraplocationWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryTraplocation: %v", err) + } +} + +func TestCreateHistoryTreatment(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().NewHistoryTreatmentWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryTreatment: %v", err) + } +} + +func TestCreateHistoryTreatmentarea(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().NewHistoryTreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryTreatmentarea: %v", err) + } +} + +func TestCreateHistoryZone(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().NewHistoryZoneWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryZone: %v", err) + } +} + +func TestCreateHistoryZones2(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().NewHistoryZones2WithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating HistoryZones2: %v", err) + } +} + func TestCreateOauthToken(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") diff --git a/factory/bobfactory_random.bob.go b/factory/bobfactory_random.bob.go index 425a8040..db6097b6 100644 --- a/factory/bobfactory_random.bob.go +++ b/factory/bobfactory_random.bob.go @@ -4,6 +4,7 @@ package factory import ( + "math" "strconv" "strings" "time" @@ -50,6 +51,43 @@ func random_enums_Hashtype(f *faker.Faker, limits ...string) enums.Hashtype { return all[f.IntBetween(0, len(all)-1)] } +func random_float64(f *faker.Faker, limits ...string) float64 { + if f == nil { + f = &defaultFaker + } + + var precision int64 = 5 + var scale int64 = 2 + + if len(limits) > 0 { + precision, _ = strconv.ParseInt(limits[0], 10, 32) + } + + if len(limits) > 1 { + scale, _ = strconv.ParseInt(limits[1], 10, 32) + } + + baseVal := f.Float64(10, -1, 1) + for baseVal == -1 || baseVal == 0 || baseVal == 1 { + baseVal = f.Float64(10, -1, 1) + } + + scaleFloat := math.Pow10(int(scale)) + + val := baseVal * math.Pow10(int(precision)) + val = math.Trunc(val) / scaleFloat + + return val +} + +func random_int16(f *faker.Faker, limits ...string) int16 { + if f == nil { + f = &defaultFaker + } + + return f.Int16() +} + func random_int32(f *faker.Faker, limits ...string) int32 { if f == nil { f = &defaultFaker diff --git a/factory/bobfactory_random.bob_test.go b/factory/bobfactory_random.bob_test.go index adc34e89..e0de4b1c 100644 --- a/factory/bobfactory_random.bob_test.go +++ b/factory/bobfactory_random.bob_test.go @@ -24,6 +24,28 @@ func TestRandom___byte(t *testing.T) { } } +func TestRandom_float64(t *testing.T) { + t.Parallel() + + val1 := random_float64(nil) + val2 := random_float64(nil) + + if val1 == val2 { + t.Fatalf("random_float64() returned the same value twice: %v", val1) + } +} + +func TestRandom_int16(t *testing.T) { + t.Parallel() + + val1 := random_int16(nil) + val2 := random_int16(nil) + + if val1 == val2 { + t.Fatalf("random_int16() returned the same value twice: %v", val1) + } +} + func TestRandom_int32(t *testing.T) { t.Parallel() diff --git a/factory/fs_containerrelate.bob.go b/factory/fs_containerrelate.bob.go new file mode 100644 index 00000000..c0f229ca --- /dev/null +++ b/factory/fs_containerrelate.bob.go @@ -0,0 +1,1360 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSContainerrelateMod interface { + Apply(context.Context, *FSContainerrelateTemplate) +} + +type FSContainerrelateModFunc func(context.Context, *FSContainerrelateTemplate) + +func (f FSContainerrelateModFunc) Apply(ctx context.Context, n *FSContainerrelateTemplate) { + f(ctx, n) +} + +type FSContainerrelateModSlice []FSContainerrelateMod + +func (mods FSContainerrelateModSlice) Apply(ctx context.Context, n *FSContainerrelateTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Containertype func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Inspsampleid func() null.Val[string] + Mosquitoinspid func() null.Val[string] + Objectid func() int32 + Treatmentid func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsContainerrelateR + f *Factory + + alreadyPersisted bool +} + +type fsContainerrelateR struct { + Organization *fsContainerrelateROrganizationR +} + +type fsContainerrelateROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSContainerrelateTemplate +func (o *FSContainerrelateTemplate) Apply(ctx context.Context, mods ...FSContainerrelateMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSContainerrelate +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSContainerrelateSetter +// this does nothing with the relationship templates +func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter { + m := &models.FSContainerrelateSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Containertype != nil { + val := o.Containertype() + m.Containertype = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Inspsampleid != nil { + val := o.Inspsampleid() + m.Inspsampleid = omitnull.FromNull(val) + } + if o.Mosquitoinspid != nil { + val := o.Mosquitoinspid() + m.Mosquitoinspid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Treatmentid != nil { + val := o.Treatmentid() + m.Treatmentid = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSContainerrelateSetter +// this does nothing with the relationship templates +func (o FSContainerrelateTemplate) BuildManySetter(number int) []*models.FSContainerrelateSetter { + m := make([]*models.FSContainerrelateSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSContainerrelate +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.Create +func (o FSContainerrelateTemplate) Build() *models.FSContainerrelate { + m := &models.FSContainerrelate{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Containertype != nil { + m.Containertype = o.Containertype() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Inspsampleid != nil { + m.Inspsampleid = o.Inspsampleid() + } + if o.Mosquitoinspid != nil { + m.Mosquitoinspid = o.Mosquitoinspid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Treatmentid != nil { + m.Treatmentid = o.Treatmentid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSContainerrelateSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.CreateMany +func (o FSContainerrelateTemplate) BuildMany(number int) models.FSContainerrelateSlice { + m := make(models.FSContainerrelateSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSContainerrelate +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsContainerrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSContainerrelate, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSContainerrelate(opt) + + m, err := models.FSContainerrelates.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsContainerrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSContainerrelate { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsContainerrelate 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 *FSContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSContainerrelate { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsContainerrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSContainerrelateSlice, error) { + var err error + m := make(models.FSContainerrelateSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsContainerrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSContainerrelateSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsContainerrelates 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 FSContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSContainerrelateSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSContainerrelate has methods that act as mods for the FSContainerrelateTemplate +var FSContainerrelateMods fsContainerrelateMods + +type fsContainerrelateMods struct{} + +func (m fsContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModSlice{ + FSContainerrelateMods.RandomOrganizationID(f), + FSContainerrelateMods.RandomContainertype(f), + FSContainerrelateMods.RandomCreationdate(f), + FSContainerrelateMods.RandomCreator(f), + FSContainerrelateMods.RandomEditdate(f), + FSContainerrelateMods.RandomEditor(f), + FSContainerrelateMods.RandomGlobalid(f), + FSContainerrelateMods.RandomInspsampleid(f), + FSContainerrelateMods.RandomMosquitoinspid(f), + FSContainerrelateMods.RandomObjectid(f), + FSContainerrelateMods.RandomTreatmentid(f), + FSContainerrelateMods.RandomCreatedDate(f), + FSContainerrelateMods.RandomCreatedUser(f), + FSContainerrelateMods.RandomGeometryX(f), + FSContainerrelateMods.RandomGeometryY(f), + FSContainerrelateMods.RandomLastEditedDate(f), + FSContainerrelateMods.RandomLastEditedUser(f), + FSContainerrelateMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsContainerrelateMods) OrganizationID(val null.Val[int32]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetOrganizationID() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Containertype(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Containertype = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetContainertype() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Containertype = 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 fsContainerrelateMods) RandomContainertype(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomContainertypeNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Creationdate(val null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetCreationdate() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creationdate = 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 fsContainerrelateMods) RandomCreationdate(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Creator(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) CreatorFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetCreator() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creator = 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 fsContainerrelateMods) RandomCreator(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Editdate(val null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) EditdateFunc(f func() null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetEditdate() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editdate = 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 fsContainerrelateMods) RandomEditdate(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Editor(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) EditorFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetEditor() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editor = 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 fsContainerrelateMods) RandomEditor(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Globalid(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) GlobalidFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetGlobalid() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Globalid = 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 fsContainerrelateMods) RandomGlobalid(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Inspsampleid(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Inspsampleid = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetInspsampleid() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Inspsampleid = 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 fsContainerrelateMods) RandomInspsampleid(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspsampleidNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Mosquitoinspid(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Mosquitoinspid = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetMosquitoinspid() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Mosquitoinspid = 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 fsContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMosquitoinspidNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Objectid(val int32) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) ObjectidFunc(f func() int32) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetObjectid() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsContainerrelateMods) RandomObjectid(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Treatmentid(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Treatmentid = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetTreatmentid() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Treatmentid = 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 fsContainerrelateMods) RandomTreatmentid(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatmentidNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) CreatedDate(val null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetCreatedDate() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedDate = 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 fsContainerrelateMods) RandomCreatedDate(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) CreatedUser(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetCreatedUser() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedUser = 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 fsContainerrelateMods) RandomCreatedUser(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) GeometryX(val null.Val[float64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetGeometryX() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryX = 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 fsContainerrelateMods) RandomGeometryX(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) GeometryY(val null.Val[float64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetGeometryY() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryY = 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 fsContainerrelateMods) RandomGeometryY(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) LastEditedDate(val null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetLastEditedDate() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedDate = 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 fsContainerrelateMods) RandomLastEditedDate(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) LastEditedUser(val null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetLastEditedUser() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedUser = 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 fsContainerrelateMods) RandomLastEditedUser(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsContainerrelateMods) Updated(val time.Time) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsContainerrelateMods) UpdatedFunc(f func() time.Time) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsContainerrelateMods) UnsetUpdated() FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsContainerrelateMods) RandomUpdated(f *faker.Faker) FSContainerrelateMod { + return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsContainerrelateMods) WithParentsCascading() FSContainerrelateMod { + return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { + if isDone, _ := fsContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsContainerrelateMods) WithOrganization(rel *OrganizationTemplate) FSContainerrelateMod { + return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { + o.r.Organization = &fsContainerrelateROrganizationR{ + o: rel, + } + }) +} + +func (m fsContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) FSContainerrelateMod { + return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsContainerrelateMods) WithExistingOrganization(em *models.Organization) FSContainerrelateMod { + return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { + o.r.Organization = &fsContainerrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsContainerrelateMods) WithoutOrganization() FSContainerrelateMod { + return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_fieldscoutinglog.bob.go b/factory/fs_fieldscoutinglog.bob.go new file mode 100644 index 00000000..7e3bfd17 --- /dev/null +++ b/factory/fs_fieldscoutinglog.bob.go @@ -0,0 +1,1174 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSFieldscoutinglogMod interface { + Apply(context.Context, *FSFieldscoutinglogTemplate) +} + +type FSFieldscoutinglogModFunc func(context.Context, *FSFieldscoutinglogTemplate) + +func (f FSFieldscoutinglogModFunc) Apply(ctx context.Context, n *FSFieldscoutinglogTemplate) { + f(ctx, n) +} + +type FSFieldscoutinglogModSlice []FSFieldscoutinglogMod + +func (mods FSFieldscoutinglogModSlice) Apply(ctx context.Context, n *FSFieldscoutinglogTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Objectid func() int32 + Status func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsFieldscoutinglogR + f *Factory + + alreadyPersisted bool +} + +type fsFieldscoutinglogR struct { + Organization *fsFieldscoutinglogROrganizationR +} + +type fsFieldscoutinglogROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSFieldscoutinglogTemplate +func (o *FSFieldscoutinglogTemplate) Apply(ctx context.Context, mods ...FSFieldscoutinglogMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSFieldscoutinglog +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSFieldscoutinglogSetter +// this does nothing with the relationship templates +func (o FSFieldscoutinglogTemplate) BuildSetter() *models.FSFieldscoutinglogSetter { + m := &models.FSFieldscoutinglogSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Status != nil { + val := o.Status() + m.Status = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSFieldscoutinglogSetter +// this does nothing with the relationship templates +func (o FSFieldscoutinglogTemplate) BuildManySetter(number int) []*models.FSFieldscoutinglogSetter { + m := make([]*models.FSFieldscoutinglogSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSFieldscoutinglog +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSFieldscoutinglogTemplate.Create +func (o FSFieldscoutinglogTemplate) Build() *models.FSFieldscoutinglog { + m := &models.FSFieldscoutinglog{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Status != nil { + m.Status = o.Status() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSFieldscoutinglogSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSFieldscoutinglogTemplate.CreateMany +func (o FSFieldscoutinglogTemplate) BuildMany(number int) models.FSFieldscoutinglogSlice { + m := make(models.FSFieldscoutinglogSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSFieldscoutinglog +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsFieldscoutinglog and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSFieldscoutinglog, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSFieldscoutinglog(opt) + + m, err := models.FSFieldscoutinglogs.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsFieldscoutinglog and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSFieldscoutinglog { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsFieldscoutinglog 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 *FSFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSFieldscoutinglog { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsFieldscoutinglogs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSFieldscoutinglogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSFieldscoutinglogSlice, error) { + var err error + m := make(models.FSFieldscoutinglogSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsFieldscoutinglogs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSFieldscoutinglogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSFieldscoutinglogSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsFieldscoutinglogs 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 FSFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSFieldscoutinglogSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSFieldscoutinglog has methods that act as mods for the FSFieldscoutinglogTemplate +var FSFieldscoutinglogMods fsFieldscoutinglogMods + +type fsFieldscoutinglogMods struct{} + +func (m fsFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModSlice{ + FSFieldscoutinglogMods.RandomOrganizationID(f), + FSFieldscoutinglogMods.RandomCreationdate(f), + FSFieldscoutinglogMods.RandomCreator(f), + FSFieldscoutinglogMods.RandomEditdate(f), + FSFieldscoutinglogMods.RandomEditor(f), + FSFieldscoutinglogMods.RandomGlobalid(f), + FSFieldscoutinglogMods.RandomObjectid(f), + FSFieldscoutinglogMods.RandomStatus(f), + FSFieldscoutinglogMods.RandomCreatedDate(f), + FSFieldscoutinglogMods.RandomCreatedUser(f), + FSFieldscoutinglogMods.RandomGeometryX(f), + FSFieldscoutinglogMods.RandomGeometryY(f), + FSFieldscoutinglogMods.RandomLastEditedDate(f), + FSFieldscoutinglogMods.RandomLastEditedUser(f), + FSFieldscoutinglogMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) OrganizationID(val null.Val[int32]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetOrganizationID() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Creationdate(val null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) CreationdateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetCreationdate() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creationdate = 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 fsFieldscoutinglogMods) RandomCreationdate(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Creator(val null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetCreator() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creator = 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 fsFieldscoutinglogMods) RandomCreator(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Editdate(val null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) EditdateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetEditdate() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editdate = 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 fsFieldscoutinglogMods) RandomEditdate(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Editor(val null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetEditor() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editor = 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 fsFieldscoutinglogMods) RandomEditor(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Globalid(val null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) GlobalidFunc(f func() null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetGlobalid() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Globalid = 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 fsFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Objectid(val int32) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) ObjectidFunc(f func() int32) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetObjectid() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsFieldscoutinglogMods) RandomObjectid(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Status(val null.Val[int16]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Status = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetStatus() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Status = 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 fsFieldscoutinglogMods) RandomStatus(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomStatusNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) CreatedDate(val null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetCreatedDate() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedDate = 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 fsFieldscoutinglogMods) RandomCreatedDate(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) CreatedUser(val null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetCreatedUser() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedUser = 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 fsFieldscoutinglogMods) RandomCreatedUser(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) GeometryX(val null.Val[float64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) GeometryXFunc(f func() null.Val[float64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetGeometryX() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryX = 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 fsFieldscoutinglogMods) RandomGeometryX(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) GeometryY(val null.Val[float64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) GeometryYFunc(f func() null.Val[float64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetGeometryY() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryY = 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 fsFieldscoutinglogMods) RandomGeometryY(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) LastEditedDate(val null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetLastEditedDate() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedDate = 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 fsFieldscoutinglogMods) RandomLastEditedDate(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) LastEditedUser(val null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetLastEditedUser() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedUser = 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 fsFieldscoutinglogMods) RandomLastEditedUser(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsFieldscoutinglogMods) Updated(val time.Time) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsFieldscoutinglogMods) UpdatedFunc(f func() time.Time) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsFieldscoutinglogMods) UnsetUpdated() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsFieldscoutinglogMods) RandomUpdated(f *faker.Faker) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsFieldscoutinglogMods) WithParentsCascading() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { + if isDone, _ := fsFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { + o.r.Organization = &fsFieldscoutinglogROrganizationR{ + o: rel, + } + }) +} + +func (m fsFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { + o.r.Organization = &fsFieldscoutinglogROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsFieldscoutinglogMods) WithoutOrganization() FSFieldscoutinglogMod { + return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_habitatrelate.bob.go b/factory/fs_habitatrelate.bob.go new file mode 100644 index 00000000..71e8dc2b --- /dev/null +++ b/factory/fs_habitatrelate.bob.go @@ -0,0 +1,1236 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSHabitatrelateMod interface { + Apply(context.Context, *FSHabitatrelateTemplate) +} + +type FSHabitatrelateModFunc func(context.Context, *FSHabitatrelateTemplate) + +func (f FSHabitatrelateModFunc) Apply(ctx context.Context, n *FSHabitatrelateTemplate) { + f(ctx, n) +} + +type FSHabitatrelateModSlice []FSHabitatrelateMod + +func (mods FSHabitatrelateModSlice) Apply(ctx context.Context, n *FSHabitatrelateTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + ForeignID func() null.Val[string] + Globalid func() null.Val[string] + Habitattype func() null.Val[string] + Objectid func() int32 + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsHabitatrelateR + f *Factory + + alreadyPersisted bool +} + +type fsHabitatrelateR struct { + Organization *fsHabitatrelateROrganizationR +} + +type fsHabitatrelateROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSHabitatrelateTemplate +func (o *FSHabitatrelateTemplate) Apply(ctx context.Context, mods ...FSHabitatrelateMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSHabitatrelate +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSHabitatrelateSetter +// this does nothing with the relationship templates +func (o FSHabitatrelateTemplate) BuildSetter() *models.FSHabitatrelateSetter { + m := &models.FSHabitatrelateSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.ForeignID != nil { + val := o.ForeignID() + m.ForeignID = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitattype != nil { + val := o.Habitattype() + m.Habitattype = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSHabitatrelateSetter +// this does nothing with the relationship templates +func (o FSHabitatrelateTemplate) BuildManySetter(number int) []*models.FSHabitatrelateSetter { + m := make([]*models.FSHabitatrelateSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSHabitatrelate +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSHabitatrelateTemplate.Create +func (o FSHabitatrelateTemplate) Build() *models.FSHabitatrelate { + m := &models.FSHabitatrelate{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.ForeignID != nil { + m.ForeignID = o.ForeignID() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitattype != nil { + m.Habitattype = o.Habitattype() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSHabitatrelateSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSHabitatrelateTemplate.CreateMany +func (o FSHabitatrelateTemplate) BuildMany(number int) models.FSHabitatrelateSlice { + m := make(models.FSHabitatrelateSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSHabitatrelate +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsHabitatrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSHabitatrelate, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSHabitatrelate(opt) + + m, err := models.FSHabitatrelates.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsHabitatrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSHabitatrelate { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsHabitatrelate 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 *FSHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSHabitatrelate { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsHabitatrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSHabitatrelateSlice, error) { + var err error + m := make(models.FSHabitatrelateSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsHabitatrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSHabitatrelateSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsHabitatrelates 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 FSHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSHabitatrelateSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSHabitatrelate has methods that act as mods for the FSHabitatrelateTemplate +var FSHabitatrelateMods fsHabitatrelateMods + +type fsHabitatrelateMods struct{} + +func (m fsHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModSlice{ + FSHabitatrelateMods.RandomOrganizationID(f), + FSHabitatrelateMods.RandomCreationdate(f), + FSHabitatrelateMods.RandomCreator(f), + FSHabitatrelateMods.RandomEditdate(f), + FSHabitatrelateMods.RandomEditor(f), + FSHabitatrelateMods.RandomForeignID(f), + FSHabitatrelateMods.RandomGlobalid(f), + FSHabitatrelateMods.RandomHabitattype(f), + FSHabitatrelateMods.RandomObjectid(f), + FSHabitatrelateMods.RandomCreatedDate(f), + FSHabitatrelateMods.RandomCreatedUser(f), + FSHabitatrelateMods.RandomGeometryX(f), + FSHabitatrelateMods.RandomGeometryY(f), + FSHabitatrelateMods.RandomLastEditedDate(f), + FSHabitatrelateMods.RandomLastEditedUser(f), + FSHabitatrelateMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) OrganizationID(val null.Val[int32]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetOrganizationID() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Creationdate(val null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) CreationdateFunc(f func() null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetCreationdate() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creationdate = 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 fsHabitatrelateMods) RandomCreationdate(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Creator(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) CreatorFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetCreator() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creator = 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 fsHabitatrelateMods) RandomCreator(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Editdate(val null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) EditdateFunc(f func() null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetEditdate() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editdate = 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 fsHabitatrelateMods) RandomEditdate(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Editor(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) EditorFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetEditor() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editor = 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 fsHabitatrelateMods) RandomEditor(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) ForeignID(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) ForeignIDFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.ForeignID = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetForeignID() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.ForeignID = 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 fsHabitatrelateMods) RandomForeignID(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomForeignIDNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Globalid(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) GlobalidFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetGlobalid() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Globalid = 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 fsHabitatrelateMods) RandomGlobalid(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Habitattype(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Habitattype = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetHabitattype() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Habitattype = 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 fsHabitatrelateMods) RandomHabitattype(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitattypeNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Objectid(val int32) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) ObjectidFunc(f func() int32) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetObjectid() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsHabitatrelateMods) RandomObjectid(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) CreatedDate(val null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) CreatedDateFunc(f func() null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetCreatedDate() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedDate = 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 fsHabitatrelateMods) RandomCreatedDate(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) CreatedUser(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetCreatedUser() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedUser = 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 fsHabitatrelateMods) RandomCreatedUser(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) GeometryX(val null.Val[float64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) GeometryXFunc(f func() null.Val[float64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetGeometryX() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryX = 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 fsHabitatrelateMods) RandomGeometryX(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) GeometryY(val null.Val[float64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) GeometryYFunc(f func() null.Val[float64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetGeometryY() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryY = 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 fsHabitatrelateMods) RandomGeometryY(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) LastEditedDate(val null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) LastEditedDateFunc(f func() null.Val[int64]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetLastEditedDate() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedDate = 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 fsHabitatrelateMods) RandomLastEditedDate(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) LastEditedUser(val null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetLastEditedUser() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedUser = 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 fsHabitatrelateMods) RandomLastEditedUser(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsHabitatrelateMods) Updated(val time.Time) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsHabitatrelateMods) UpdatedFunc(f func() time.Time) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsHabitatrelateMods) UnsetUpdated() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsHabitatrelateMods) RandomUpdated(f *faker.Faker) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsHabitatrelateMods) WithParentsCascading() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { + if isDone, _ := fsHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { + o.r.Organization = &fsHabitatrelateROrganizationR{ + o: rel, + } + }) +} + +func (m fsHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsHabitatrelateMods) WithExistingOrganization(em *models.Organization) FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { + o.r.Organization = &fsHabitatrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsHabitatrelateMods) WithoutOrganization() FSHabitatrelateMod { + return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_inspectionsample.bob.go b/factory/fs_inspectionsample.bob.go new file mode 100644 index 00000000..759ff44a --- /dev/null +++ b/factory/fs_inspectionsample.bob.go @@ -0,0 +1,1360 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSInspectionsampleMod interface { + Apply(context.Context, *FSInspectionsampleTemplate) +} + +type FSInspectionsampleModFunc func(context.Context, *FSInspectionsampleTemplate) + +func (f FSInspectionsampleModFunc) Apply(ctx context.Context, n *FSInspectionsampleTemplate) { + f(ctx, n) +} + +type FSInspectionsampleModSlice []FSInspectionsampleMod + +func (mods FSInspectionsampleModSlice) Apply(ctx context.Context, n *FSInspectionsampleTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Idbytech func() null.Val[string] + InspID func() null.Val[string] + Objectid func() int32 + Processed func() null.Val[int16] + Sampleid func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsInspectionsampleR + f *Factory + + alreadyPersisted bool +} + +type fsInspectionsampleR struct { + Organization *fsInspectionsampleROrganizationR +} + +type fsInspectionsampleROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSInspectionsampleTemplate +func (o *FSInspectionsampleTemplate) Apply(ctx context.Context, mods ...FSInspectionsampleMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSInspectionsample +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSInspectionsampleSetter +// this does nothing with the relationship templates +func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSetter { + m := &models.FSInspectionsampleSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Idbytech != nil { + val := o.Idbytech() + m.Idbytech = omitnull.FromNull(val) + } + if o.InspID != nil { + val := o.InspID() + m.InspID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSInspectionsampleSetter +// this does nothing with the relationship templates +func (o FSInspectionsampleTemplate) BuildManySetter(number int) []*models.FSInspectionsampleSetter { + m := make([]*models.FSInspectionsampleSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSInspectionsample +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.Create +func (o FSInspectionsampleTemplate) Build() *models.FSInspectionsample { + m := &models.FSInspectionsample{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Idbytech != nil { + m.Idbytech = o.Idbytech() + } + if o.InspID != nil { + m.InspID = o.InspID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSInspectionsampleSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.CreateMany +func (o FSInspectionsampleTemplate) BuildMany(number int) models.FSInspectionsampleSlice { + m := make(models.FSInspectionsampleSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSInspectionsample +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsInspectionsample and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSInspectionsample, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSInspectionsample(opt) + + m, err := models.FSInspectionsamples.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsInspectionsample and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSInspectionsample { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsInspectionsample 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 *FSInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSInspectionsample { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsInspectionsamples and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSInspectionsampleSlice, error) { + var err error + m := make(models.FSInspectionsampleSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsInspectionsamples and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSInspectionsampleSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsInspectionsamples 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 FSInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSInspectionsampleSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSInspectionsample has methods that act as mods for the FSInspectionsampleTemplate +var FSInspectionsampleMods fsInspectionsampleMods + +type fsInspectionsampleMods struct{} + +func (m fsInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModSlice{ + FSInspectionsampleMods.RandomOrganizationID(f), + FSInspectionsampleMods.RandomCreationdate(f), + FSInspectionsampleMods.RandomCreator(f), + FSInspectionsampleMods.RandomEditdate(f), + FSInspectionsampleMods.RandomEditor(f), + FSInspectionsampleMods.RandomGlobalid(f), + FSInspectionsampleMods.RandomIdbytech(f), + FSInspectionsampleMods.RandomInspID(f), + FSInspectionsampleMods.RandomObjectid(f), + FSInspectionsampleMods.RandomProcessed(f), + FSInspectionsampleMods.RandomSampleid(f), + FSInspectionsampleMods.RandomCreatedDate(f), + FSInspectionsampleMods.RandomCreatedUser(f), + FSInspectionsampleMods.RandomGeometryX(f), + FSInspectionsampleMods.RandomGeometryY(f), + FSInspectionsampleMods.RandomLastEditedDate(f), + FSInspectionsampleMods.RandomLastEditedUser(f), + FSInspectionsampleMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) OrganizationID(val null.Val[int32]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetOrganizationID() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Creationdate(val null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) CreationdateFunc(f func() null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetCreationdate() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creationdate = 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 fsInspectionsampleMods) RandomCreationdate(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Creator(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) CreatorFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetCreator() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creator = 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 fsInspectionsampleMods) RandomCreator(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Editdate(val null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) EditdateFunc(f func() null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetEditdate() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editdate = 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 fsInspectionsampleMods) RandomEditdate(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Editor(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) EditorFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetEditor() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editor = 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 fsInspectionsampleMods) RandomEditor(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Globalid(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) GlobalidFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetGlobalid() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Globalid = 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 fsInspectionsampleMods) RandomGlobalid(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Idbytech(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Idbytech = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetIdbytech() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Idbytech = 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 fsInspectionsampleMods) RandomIdbytech(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIdbytechNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) InspID(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) InspIDFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.InspID = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetInspID() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.InspID = 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 fsInspectionsampleMods) RandomInspID(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspIDNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Objectid(val int32) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) ObjectidFunc(f func() int32) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetObjectid() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsInspectionsampleMods) RandomObjectid(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Processed(val null.Val[int16]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetProcessed() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Processed = 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 fsInspectionsampleMods) RandomProcessed(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Sampleid(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) SampleidFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetSampleid() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Sampleid = 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 fsInspectionsampleMods) RandomSampleid(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) CreatedDate(val null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) CreatedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetCreatedDate() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedDate = 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 fsInspectionsampleMods) RandomCreatedDate(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) CreatedUser(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetCreatedUser() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedUser = 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 fsInspectionsampleMods) RandomCreatedUser(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) GeometryX(val null.Val[float64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) GeometryXFunc(f func() null.Val[float64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetGeometryX() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryX = 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 fsInspectionsampleMods) RandomGeometryX(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) GeometryY(val null.Val[float64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) GeometryYFunc(f func() null.Val[float64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetGeometryY() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryY = 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 fsInspectionsampleMods) RandomGeometryY(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) LastEditedDate(val null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) LastEditedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetLastEditedDate() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedDate = 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 fsInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) LastEditedUser(val null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetLastEditedUser() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedUser = 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 fsInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampleMods) Updated(val time.Time) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampleMods) UpdatedFunc(f func() time.Time) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampleMods) UnsetUpdated() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsInspectionsampleMods) RandomUpdated(f *faker.Faker) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsInspectionsampleMods) WithParentsCascading() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { + if isDone, _ := fsInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { + o.r.Organization = &fsInspectionsampleROrganizationR{ + o: rel, + } + }) +} + +func (m fsInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsInspectionsampleMods) WithExistingOrganization(em *models.Organization) FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { + o.r.Organization = &fsInspectionsampleROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsInspectionsampleMods) WithoutOrganization() FSInspectionsampleMod { + return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_inspectionsampledetail.bob.go b/factory/fs_inspectionsampledetail.bob.go new file mode 100644 index 00000000..698803e9 --- /dev/null +++ b/factory/fs_inspectionsampledetail.bob.go @@ -0,0 +1,2042 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSInspectionsampledetailMod interface { + Apply(context.Context, *FSInspectionsampledetailTemplate) +} + +type FSInspectionsampledetailModFunc func(context.Context, *FSInspectionsampledetailTemplate) + +func (f FSInspectionsampledetailModFunc) Apply(ctx context.Context, n *FSInspectionsampledetailTemplate) { + f(ctx, n) +} + +type FSInspectionsampledetailModSlice []FSInspectionsampledetailMod + +func (mods FSInspectionsampledetailModSlice) Apply(ctx context.Context, n *FSInspectionsampledetailTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fadultact func() null.Val[string] + Fdomstage func() null.Val[string] + Feggcount func() null.Val[int16] + Fieldspecies func() null.Val[string] + Flarvcount func() null.Val[int16] + Flstages func() null.Val[string] + Fpupcount func() null.Val[int16] + Globalid func() null.Val[string] + InspsampleID func() null.Val[string] + Labspecies func() null.Val[string] + Ldomstage func() null.Val[string] + Leggcount func() null.Val[int16] + Llarvcount func() null.Val[int16] + Lpupcount func() null.Val[int16] + Objectid func() int32 + Processed func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsInspectionsampledetailR + f *Factory + + alreadyPersisted bool +} + +type fsInspectionsampledetailR struct { + Organization *fsInspectionsampledetailROrganizationR +} + +type fsInspectionsampledetailROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSInspectionsampledetailTemplate +func (o *FSInspectionsampledetailTemplate) Apply(ctx context.Context, mods ...FSInspectionsampledetailMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSInspectionsampledetail +// according to the relationships in the template. Nothing is inserted into the db +func (t FSInspectionsampledetailTemplate) setModelRels(o *models.FSInspectionsampledetail) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSInspectionsampledetailSetter +// this does nothing with the relationship templates +func (o FSInspectionsampledetailTemplate) BuildSetter() *models.FSInspectionsampledetailSetter { + m := &models.FSInspectionsampledetailSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fadultact != nil { + val := o.Fadultact() + m.Fadultact = omitnull.FromNull(val) + } + if o.Fdomstage != nil { + val := o.Fdomstage() + m.Fdomstage = omitnull.FromNull(val) + } + if o.Feggcount != nil { + val := o.Feggcount() + m.Feggcount = omitnull.FromNull(val) + } + if o.Fieldspecies != nil { + val := o.Fieldspecies() + m.Fieldspecies = omitnull.FromNull(val) + } + if o.Flarvcount != nil { + val := o.Flarvcount() + m.Flarvcount = omitnull.FromNull(val) + } + if o.Flstages != nil { + val := o.Flstages() + m.Flstages = omitnull.FromNull(val) + } + if o.Fpupcount != nil { + val := o.Fpupcount() + m.Fpupcount = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.InspsampleID != nil { + val := o.InspsampleID() + m.InspsampleID = omitnull.FromNull(val) + } + if o.Labspecies != nil { + val := o.Labspecies() + m.Labspecies = omitnull.FromNull(val) + } + if o.Ldomstage != nil { + val := o.Ldomstage() + m.Ldomstage = omitnull.FromNull(val) + } + if o.Leggcount != nil { + val := o.Leggcount() + m.Leggcount = omitnull.FromNull(val) + } + if o.Llarvcount != nil { + val := o.Llarvcount() + m.Llarvcount = omitnull.FromNull(val) + } + if o.Lpupcount != nil { + val := o.Lpupcount() + m.Lpupcount = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSInspectionsampledetailSetter +// this does nothing with the relationship templates +func (o FSInspectionsampledetailTemplate) BuildManySetter(number int) []*models.FSInspectionsampledetailSetter { + m := make([]*models.FSInspectionsampledetailSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSInspectionsampledetail +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSInspectionsampledetailTemplate.Create +func (o FSInspectionsampledetailTemplate) Build() *models.FSInspectionsampledetail { + m := &models.FSInspectionsampledetail{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fadultact != nil { + m.Fadultact = o.Fadultact() + } + if o.Fdomstage != nil { + m.Fdomstage = o.Fdomstage() + } + if o.Feggcount != nil { + m.Feggcount = o.Feggcount() + } + if o.Fieldspecies != nil { + m.Fieldspecies = o.Fieldspecies() + } + if o.Flarvcount != nil { + m.Flarvcount = o.Flarvcount() + } + if o.Flstages != nil { + m.Flstages = o.Flstages() + } + if o.Fpupcount != nil { + m.Fpupcount = o.Fpupcount() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.InspsampleID != nil { + m.InspsampleID = o.InspsampleID() + } + if o.Labspecies != nil { + m.Labspecies = o.Labspecies() + } + if o.Ldomstage != nil { + m.Ldomstage = o.Ldomstage() + } + if o.Leggcount != nil { + m.Leggcount = o.Leggcount() + } + if o.Llarvcount != nil { + m.Llarvcount = o.Llarvcount() + } + if o.Lpupcount != nil { + m.Lpupcount = o.Lpupcount() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSInspectionsampledetailSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSInspectionsampledetailTemplate.CreateMany +func (o FSInspectionsampledetailTemplate) BuildMany(number int) models.FSInspectionsampledetailSlice { + m := make(models.FSInspectionsampledetailSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSInspectionsampledetail +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsInspectionsampledetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSInspectionsampledetail, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSInspectionsampledetail(opt) + + m, err := models.FSInspectionsampledetails.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsInspectionsampledetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSInspectionsampledetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSInspectionsampledetail { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsInspectionsampledetail 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 *FSInspectionsampledetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSInspectionsampledetail { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsInspectionsampledetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSInspectionsampledetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSInspectionsampledetailSlice, error) { + var err error + m := make(models.FSInspectionsampledetailSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsInspectionsampledetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSInspectionsampledetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSInspectionsampledetailSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsInspectionsampledetails 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 FSInspectionsampledetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSInspectionsampledetailSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSInspectionsampledetail has methods that act as mods for the FSInspectionsampledetailTemplate +var FSInspectionsampledetailMods fsInspectionsampledetailMods + +type fsInspectionsampledetailMods struct{} + +func (m fsInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModSlice{ + FSInspectionsampledetailMods.RandomOrganizationID(f), + FSInspectionsampledetailMods.RandomComments(f), + FSInspectionsampledetailMods.RandomCreationdate(f), + FSInspectionsampledetailMods.RandomCreator(f), + FSInspectionsampledetailMods.RandomEditdate(f), + FSInspectionsampledetailMods.RandomEditor(f), + FSInspectionsampledetailMods.RandomFadultact(f), + FSInspectionsampledetailMods.RandomFdomstage(f), + FSInspectionsampledetailMods.RandomFeggcount(f), + FSInspectionsampledetailMods.RandomFieldspecies(f), + FSInspectionsampledetailMods.RandomFlarvcount(f), + FSInspectionsampledetailMods.RandomFlstages(f), + FSInspectionsampledetailMods.RandomFpupcount(f), + FSInspectionsampledetailMods.RandomGlobalid(f), + FSInspectionsampledetailMods.RandomInspsampleID(f), + FSInspectionsampledetailMods.RandomLabspecies(f), + FSInspectionsampledetailMods.RandomLdomstage(f), + FSInspectionsampledetailMods.RandomLeggcount(f), + FSInspectionsampledetailMods.RandomLlarvcount(f), + FSInspectionsampledetailMods.RandomLpupcount(f), + FSInspectionsampledetailMods.RandomObjectid(f), + FSInspectionsampledetailMods.RandomProcessed(f), + FSInspectionsampledetailMods.RandomCreatedDate(f), + FSInspectionsampledetailMods.RandomCreatedUser(f), + FSInspectionsampledetailMods.RandomGeometryX(f), + FSInspectionsampledetailMods.RandomGeometryY(f), + FSInspectionsampledetailMods.RandomLastEditedDate(f), + FSInspectionsampledetailMods.RandomLastEditedUser(f), + FSInspectionsampledetailMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) OrganizationID(val null.Val[int32]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetOrganizationID() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Comments(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) CommentsFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetComments() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Comments = 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 fsInspectionsampledetailMods) RandomComments(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Creationdate(val null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) CreationdateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetCreationdate() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creationdate = 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 fsInspectionsampledetailMods) RandomCreationdate(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Creator(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) CreatorFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetCreator() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creator = 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 fsInspectionsampledetailMods) RandomCreator(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Editdate(val null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) EditdateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetEditdate() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editdate = 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 fsInspectionsampledetailMods) RandomEditdate(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Editor(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) EditorFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetEditor() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editor = 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 fsInspectionsampledetailMods) RandomEditor(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Fadultact(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fadultact = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFadultact() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fadultact = 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 fsInspectionsampledetailMods) RandomFadultact(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFadultactNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Fdomstage(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fdomstage = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFdomstage() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fdomstage = 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 fsInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFdomstageNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Feggcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FeggcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Feggcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFeggcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Feggcount = 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 fsInspectionsampledetailMods) RandomFeggcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFeggcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Fieldspecies(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fieldspecies = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFieldspecies() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fieldspecies = 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 fsInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldspeciesNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Flarvcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FlarvcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flarvcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFlarvcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flarvcount = 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 fsInspectionsampledetailMods) RandomFlarvcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFlarvcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Flstages(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FlstagesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flstages = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFlstages() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flstages = 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 fsInspectionsampledetailMods) RandomFlstages(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFlstagesNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Fpupcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) FpupcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fpupcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetFpupcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fpupcount = 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 fsInspectionsampledetailMods) RandomFpupcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFpupcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Globalid(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) GlobalidFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetGlobalid() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Globalid = 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 fsInspectionsampledetailMods) RandomGlobalid(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) InspsampleID(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) InspsampleIDFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.InspsampleID = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetInspsampleID() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.InspsampleID = 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 fsInspectionsampledetailMods) RandomInspsampleID(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspsampleIDNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Labspecies(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LabspeciesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Labspecies = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLabspecies() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Labspecies = 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 fsInspectionsampledetailMods) RandomLabspecies(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabspeciesNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Ldomstage(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Ldomstage = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLdomstage() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Ldomstage = 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 fsInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLdomstageNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Leggcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LeggcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Leggcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLeggcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Leggcount = 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 fsInspectionsampledetailMods) RandomLeggcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLeggcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Llarvcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LlarvcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Llarvcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLlarvcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Llarvcount = 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 fsInspectionsampledetailMods) RandomLlarvcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLlarvcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Lpupcount(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LpupcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Lpupcount = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLpupcount() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Lpupcount = 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 fsInspectionsampledetailMods) RandomLpupcount(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLpupcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Objectid(val int32) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) ObjectidFunc(f func() int32) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetObjectid() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsInspectionsampledetailMods) RandomObjectid(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Processed(val null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) ProcessedFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetProcessed() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Processed = 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 fsInspectionsampledetailMods) RandomProcessed(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) CreatedDate(val null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) CreatedDateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetCreatedDate() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedDate = 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 fsInspectionsampledetailMods) RandomCreatedDate(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) CreatedUser(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) CreatedUserFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetCreatedUser() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedUser = 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 fsInspectionsampledetailMods) RandomCreatedUser(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) GeometryX(val null.Val[float64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) GeometryXFunc(f func() null.Val[float64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetGeometryX() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryX = 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 fsInspectionsampledetailMods) RandomGeometryX(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) GeometryY(val null.Val[float64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) GeometryYFunc(f func() null.Val[float64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetGeometryY() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryY = 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 fsInspectionsampledetailMods) RandomGeometryY(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) LastEditedDate(val null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LastEditedDateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLastEditedDate() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedDate = 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 fsInspectionsampledetailMods) RandomLastEditedDate(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) LastEditedUser(val null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) LastEditedUserFunc(f func() null.Val[string]) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetLastEditedUser() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedUser = 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 fsInspectionsampledetailMods) RandomLastEditedUser(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsInspectionsampledetailMods) Updated(val time.Time) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsInspectionsampledetailMods) UpdatedFunc(f func() time.Time) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsInspectionsampledetailMods) UnsetUpdated() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsInspectionsampledetailMods) RandomUpdated(f *faker.Faker) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsInspectionsampledetailMods) WithParentsCascading() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { + if isDone, _ := fsInspectionsampledetailWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsInspectionsampledetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsInspectionsampledetailMods) WithOrganization(rel *OrganizationTemplate) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { + o.r.Organization = &fsInspectionsampledetailROrganizationR{ + o: rel, + } + }) +} + +func (m fsInspectionsampledetailMods) WithNewOrganization(mods ...OrganizationMod) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsInspectionsampledetailMods) WithExistingOrganization(em *models.Organization) FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { + o.r.Organization = &fsInspectionsampledetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsInspectionsampledetailMods) WithoutOrganization() FSInspectionsampledetailMod { + return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_linelocation.bob.go b/factory/fs_linelocation.bob.go new file mode 100644 index 00000000..4ead1ee8 --- /dev/null +++ b/factory/fs_linelocation.bob.go @@ -0,0 +1,3468 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSLinelocationMod interface { + Apply(context.Context, *FSLinelocationTemplate) +} + +type FSLinelocationModFunc func(context.Context, *FSLinelocationTemplate) + +func (f FSLinelocationModFunc) Apply(ctx context.Context, n *FSLinelocationTemplate) { + f(ctx, n) +} + +type FSLinelocationModSlice []FSLinelocationMod + +func (mods FSLinelocationModSlice) Apply(ctx context.Context, n *FSLinelocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Acres func() null.Val[float64] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Hectares func() null.Val[float64] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + LengthFT func() null.Val[float64] + LengthMeters func() null.Val[float64] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + ShapeLength func() null.Val[float64] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + WidthFT func() null.Val[float64] + WidthMeters func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsLinelocationR + f *Factory + + alreadyPersisted bool +} + +type fsLinelocationR struct { + Organization *fsLinelocationROrganizationR +} + +type fsLinelocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSLinelocationTemplate +func (o *FSLinelocationTemplate) Apply(ctx context.Context, mods ...FSLinelocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSLinelocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSLinelocationSetter +// this does nothing with the relationship templates +func (o FSLinelocationTemplate) BuildSetter() *models.FSLinelocationSetter { + m := &models.FSLinelocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.LengthFT != nil { + val := o.LengthFT() + m.LengthFT = omitnull.FromNull(val) + } + if o.LengthMeters != nil { + val := o.LengthMeters() + m.LengthMeters = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.WidthFT != nil { + val := o.WidthFT() + m.WidthFT = omitnull.FromNull(val) + } + if o.WidthMeters != nil { + val := o.WidthMeters() + m.WidthMeters = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSLinelocationSetter +// this does nothing with the relationship templates +func (o FSLinelocationTemplate) BuildManySetter(number int) []*models.FSLinelocationSetter { + m := make([]*models.FSLinelocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSLinelocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSLinelocationTemplate.Create +func (o FSLinelocationTemplate) Build() *models.FSLinelocation { + m := &models.FSLinelocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.LengthFT != nil { + m.LengthFT = o.LengthFT() + } + if o.LengthMeters != nil { + m.LengthMeters = o.LengthMeters() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.WidthFT != nil { + m.WidthFT = o.WidthFT() + } + if o.WidthMeters != nil { + m.WidthMeters = o.WidthMeters() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSLinelocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSLinelocationTemplate.CreateMany +func (o FSLinelocationTemplate) BuildMany(number int) models.FSLinelocationSlice { + m := make(models.FSLinelocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSLinelocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsLinelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSLinelocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSLinelocation(opt) + + m, err := models.FSLinelocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsLinelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSLinelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSLinelocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsLinelocation 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 *FSLinelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSLinelocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsLinelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSLinelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSLinelocationSlice, error) { + var err error + m := make(models.FSLinelocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsLinelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSLinelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSLinelocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsLinelocations 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 FSLinelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSLinelocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSLinelocation has methods that act as mods for the FSLinelocationTemplate +var FSLinelocationMods fsLinelocationMods + +type fsLinelocationMods struct{} + +func (m fsLinelocationMods) RandomizeAllColumns(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModSlice{ + FSLinelocationMods.RandomOrganizationID(f), + FSLinelocationMods.RandomAccessdesc(f), + FSLinelocationMods.RandomAcres(f), + FSLinelocationMods.RandomActive(f), + FSLinelocationMods.RandomComments(f), + FSLinelocationMods.RandomCreationdate(f), + FSLinelocationMods.RandomCreator(f), + FSLinelocationMods.RandomDescription(f), + FSLinelocationMods.RandomExternalid(f), + FSLinelocationMods.RandomEditdate(f), + FSLinelocationMods.RandomEditor(f), + FSLinelocationMods.RandomGlobalid(f), + FSLinelocationMods.RandomHabitat(f), + FSLinelocationMods.RandomHectares(f), + FSLinelocationMods.RandomJurisdiction(f), + FSLinelocationMods.RandomLarvinspectinterval(f), + FSLinelocationMods.RandomLastinspectactiontaken(f), + FSLinelocationMods.RandomLastinspectactivity(f), + FSLinelocationMods.RandomLastinspectavglarvae(f), + FSLinelocationMods.RandomLastinspectavgpupae(f), + FSLinelocationMods.RandomLastinspectbreeding(f), + FSLinelocationMods.RandomLastinspectconditions(f), + FSLinelocationMods.RandomLastinspectdate(f), + FSLinelocationMods.RandomLastinspectfieldspecies(f), + FSLinelocationMods.RandomLastinspectlstages(f), + FSLinelocationMods.RandomLasttreatactivity(f), + FSLinelocationMods.RandomLasttreatdate(f), + FSLinelocationMods.RandomLasttreatproduct(f), + FSLinelocationMods.RandomLasttreatqty(f), + FSLinelocationMods.RandomLasttreatqtyunit(f), + FSLinelocationMods.RandomLengthFT(f), + FSLinelocationMods.RandomLengthMeters(f), + FSLinelocationMods.RandomLocationnumber(f), + FSLinelocationMods.RandomName(f), + FSLinelocationMods.RandomNextactiondatescheduled(f), + FSLinelocationMods.RandomObjectid(f), + FSLinelocationMods.RandomPriority(f), + FSLinelocationMods.RandomSymbology(f), + FSLinelocationMods.RandomShapeLength(f), + FSLinelocationMods.RandomUsetype(f), + FSLinelocationMods.RandomWaterorigin(f), + FSLinelocationMods.RandomWidthFT(f), + FSLinelocationMods.RandomWidthMeters(f), + FSLinelocationMods.RandomZone(f), + FSLinelocationMods.RandomZone2(f), + FSLinelocationMods.RandomCreatedDate(f), + FSLinelocationMods.RandomCreatedUser(f), + FSLinelocationMods.RandomGeometryX(f), + FSLinelocationMods.RandomGeometryY(f), + FSLinelocationMods.RandomLastEditedDate(f), + FSLinelocationMods.RandomLastEditedUser(f), + FSLinelocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsLinelocationMods) OrganizationID(val null.Val[int32]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetOrganizationID() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Accessdesc(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) AccessdescFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetAccessdesc() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Accessdesc = 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 fsLinelocationMods) RandomAccessdesc(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Acres(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) AcresFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetAcres() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Acres = 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 fsLinelocationMods) RandomAcres(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Active(val null.Val[int16]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) ActiveFunc(f func() null.Val[int16]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetActive() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Active = 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 fsLinelocationMods) RandomActive(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Comments(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) CommentsFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetComments() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Comments = 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 fsLinelocationMods) RandomComments(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Creationdate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) CreationdateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetCreationdate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creationdate = 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 fsLinelocationMods) RandomCreationdate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Creator(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) CreatorFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetCreator() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creator = 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 fsLinelocationMods) RandomCreator(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Description(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) DescriptionFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetDescription() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Description = 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 fsLinelocationMods) RandomDescription(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Externalid(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) ExternalidFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetExternalid() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Externalid = 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 fsLinelocationMods) RandomExternalid(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Editdate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) EditdateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetEditdate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editdate = 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 fsLinelocationMods) RandomEditdate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Editor(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) EditorFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetEditor() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editor = 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 fsLinelocationMods) RandomEditor(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Globalid(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) GlobalidFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetGlobalid() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Globalid = 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 fsLinelocationMods) RandomGlobalid(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Habitat(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) HabitatFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetHabitat() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Habitat = 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 fsLinelocationMods) RandomHabitat(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Hectares(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) HectaresFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetHectares() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Hectares = 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 fsLinelocationMods) RandomHectares(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Jurisdiction(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) JurisdictionFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetJurisdiction() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Jurisdiction = 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 fsLinelocationMods) RandomJurisdiction(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Larvinspectinterval(val null.Val[int16]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLarvinspectinterval() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Larvinspectinterval = 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 fsLinelocationMods) RandomLarvinspectinterval(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectactiontaken(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectactiontaken() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactiontaken = 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 fsLinelocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectactivity(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectactivity() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactivity = 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 fsLinelocationMods) RandomLastinspectactivity(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectavglarvae(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectavglarvae() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavglarvae = 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 fsLinelocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectavgpupae(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectavgpupae() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavgpupae = 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 fsLinelocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectbreeding(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectbreeding() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectbreeding = 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 fsLinelocationMods) RandomLastinspectbreeding(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectconditions(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectconditions() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectconditions = 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 fsLinelocationMods) RandomLastinspectconditions(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectdate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectdate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectdate = 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 fsLinelocationMods) RandomLastinspectdate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectfieldspecies(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectfieldspecies() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectfieldspecies = 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 fsLinelocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lastinspectlstages(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastinspectlstages() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectlstages = 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 fsLinelocationMods) RandomLastinspectlstages(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lasttreatactivity(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLasttreatactivity() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatactivity = 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 fsLinelocationMods) RandomLasttreatactivity(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lasttreatdate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLasttreatdate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatdate = 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 fsLinelocationMods) RandomLasttreatdate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lasttreatproduct(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LasttreatproductFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLasttreatproduct() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatproduct = 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 fsLinelocationMods) RandomLasttreatproduct(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lasttreatqty(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLasttreatqty() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqty = 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 fsLinelocationMods) RandomLasttreatqty(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Lasttreatqtyunit(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLasttreatqtyunit() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqtyunit = 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 fsLinelocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) LengthFT(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LengthFTFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthFT = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLengthFT() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthFT = 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 fsLinelocationMods) RandomLengthFT(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLengthFTNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) LengthMeters(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LengthMetersFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthMeters = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLengthMeters() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthMeters = 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 fsLinelocationMods) RandomLengthMeters(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLengthMetersNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Locationnumber(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LocationnumberFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLocationnumber() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Locationnumber = 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 fsLinelocationMods) RandomLocationnumber(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Name(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) NameFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetName() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Name = 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 fsLinelocationMods) RandomName(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Nextactiondatescheduled(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetNextactiondatescheduled() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Nextactiondatescheduled = 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 fsLinelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Objectid(val int32) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) ObjectidFunc(f func() int32) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetObjectid() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsLinelocationMods) RandomObjectid(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Priority(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) PriorityFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetPriority() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Priority = 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 fsLinelocationMods) RandomPriority(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Symbology(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) SymbologyFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetSymbology() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Symbology = 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 fsLinelocationMods) RandomSymbology(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) ShapeLength(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) ShapeLengthFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetShapeLength() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.ShapeLength = 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 fsLinelocationMods) RandomShapeLength(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Usetype(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) UsetypeFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetUsetype() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Usetype = 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 fsLinelocationMods) RandomUsetype(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Waterorigin(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) WateroriginFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetWaterorigin() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Waterorigin = 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 fsLinelocationMods) RandomWaterorigin(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) WidthFT(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) WidthFTFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthFT = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetWidthFT() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthFT = 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 fsLinelocationMods) RandomWidthFT(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWidthFTNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) WidthMeters(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) WidthMetersFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthMeters = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetWidthMeters() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthMeters = 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 fsLinelocationMods) RandomWidthMeters(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWidthMetersNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Zone(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) ZoneFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetZone() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone = 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 fsLinelocationMods) RandomZone(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Zone2(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) Zone2Func(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetZone2() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone2 = 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 fsLinelocationMods) RandomZone2(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) CreatedDate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) CreatedDateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetCreatedDate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedDate = 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 fsLinelocationMods) RandomCreatedDate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) CreatedUser(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) CreatedUserFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetCreatedUser() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedUser = 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 fsLinelocationMods) RandomCreatedUser(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) GeometryX(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) GeometryXFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetGeometryX() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryX = 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 fsLinelocationMods) RandomGeometryX(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) GeometryY(val null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) GeometryYFunc(f func() null.Val[float64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetGeometryY() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryY = 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 fsLinelocationMods) RandomGeometryY(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) LastEditedDate(val null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastEditedDate() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedDate = 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 fsLinelocationMods) RandomLastEditedDate(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) LastEditedUser(val null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) LastEditedUserFunc(f func() null.Val[string]) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetLastEditedUser() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedUser = 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 fsLinelocationMods) RandomLastEditedUser(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLinelocationMods) Updated(val time.Time) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsLinelocationMods) UpdatedFunc(f func() time.Time) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsLinelocationMods) UnsetUpdated() FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsLinelocationMods) RandomUpdated(f *faker.Faker) FSLinelocationMod { + return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsLinelocationMods) WithParentsCascading() FSLinelocationMod { + return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { + if isDone, _ := fsLinelocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsLinelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsLinelocationMods) WithOrganization(rel *OrganizationTemplate) FSLinelocationMod { + return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { + o.r.Organization = &fsLinelocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsLinelocationMods) WithNewOrganization(mods ...OrganizationMod) FSLinelocationMod { + return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsLinelocationMods) WithExistingOrganization(em *models.Organization) FSLinelocationMod { + return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { + o.r.Organization = &fsLinelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsLinelocationMods) WithoutOrganization() FSLinelocationMod { + return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_locationtracking.bob.go b/factory/fs_locationtracking.bob.go new file mode 100644 index 00000000..625cbcd6 --- /dev/null +++ b/factory/fs_locationtracking.bob.go @@ -0,0 +1,1236 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSLocationtrackingMod interface { + Apply(context.Context, *FSLocationtrackingTemplate) +} + +type FSLocationtrackingModFunc func(context.Context, *FSLocationtrackingTemplate) + +func (f FSLocationtrackingModFunc) Apply(ctx context.Context, n *FSLocationtrackingTemplate) { + f(ctx, n) +} + +type FSLocationtrackingModSlice []FSLocationtrackingMod + +func (mods FSLocationtrackingModSlice) Apply(ctx context.Context, n *FSLocationtrackingTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accuracy func() null.Val[float64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Objectid func() int32 + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsLocationtrackingR + f *Factory + + alreadyPersisted bool +} + +type fsLocationtrackingR struct { + Organization *fsLocationtrackingROrganizationR +} + +type fsLocationtrackingROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSLocationtrackingTemplate +func (o *FSLocationtrackingTemplate) Apply(ctx context.Context, mods ...FSLocationtrackingMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSLocationtracking +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSLocationtrackingSetter +// this does nothing with the relationship templates +func (o FSLocationtrackingTemplate) BuildSetter() *models.FSLocationtrackingSetter { + m := &models.FSLocationtrackingSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accuracy != nil { + val := o.Accuracy() + m.Accuracy = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSLocationtrackingSetter +// this does nothing with the relationship templates +func (o FSLocationtrackingTemplate) BuildManySetter(number int) []*models.FSLocationtrackingSetter { + m := make([]*models.FSLocationtrackingSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSLocationtracking +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSLocationtrackingTemplate.Create +func (o FSLocationtrackingTemplate) Build() *models.FSLocationtracking { + m := &models.FSLocationtracking{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accuracy != nil { + m.Accuracy = o.Accuracy() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSLocationtrackingSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSLocationtrackingTemplate.CreateMany +func (o FSLocationtrackingTemplate) BuildMany(number int) models.FSLocationtrackingSlice { + m := make(models.FSLocationtrackingSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSLocationtracking +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsLocationtracking and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSLocationtrackingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSLocationtracking, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSLocationtracking(opt) + + m, err := models.FSLocationtrackings.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsLocationtracking and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSLocationtrackingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSLocationtracking { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsLocationtracking 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 *FSLocationtrackingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSLocationtracking { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsLocationtrackings and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSLocationtrackingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSLocationtrackingSlice, error) { + var err error + m := make(models.FSLocationtrackingSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsLocationtrackings and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSLocationtrackingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSLocationtrackingSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsLocationtrackings 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 FSLocationtrackingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSLocationtrackingSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSLocationtracking has methods that act as mods for the FSLocationtrackingTemplate +var FSLocationtrackingMods fsLocationtrackingMods + +type fsLocationtrackingMods struct{} + +func (m fsLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModSlice{ + FSLocationtrackingMods.RandomOrganizationID(f), + FSLocationtrackingMods.RandomAccuracy(f), + FSLocationtrackingMods.RandomCreationdate(f), + FSLocationtrackingMods.RandomCreator(f), + FSLocationtrackingMods.RandomEditdate(f), + FSLocationtrackingMods.RandomEditor(f), + FSLocationtrackingMods.RandomFieldtech(f), + FSLocationtrackingMods.RandomGlobalid(f), + FSLocationtrackingMods.RandomObjectid(f), + FSLocationtrackingMods.RandomCreatedDate(f), + FSLocationtrackingMods.RandomCreatedUser(f), + FSLocationtrackingMods.RandomGeometryX(f), + FSLocationtrackingMods.RandomGeometryY(f), + FSLocationtrackingMods.RandomLastEditedDate(f), + FSLocationtrackingMods.RandomLastEditedUser(f), + FSLocationtrackingMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) OrganizationID(val null.Val[int32]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetOrganizationID() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Accuracy(val null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) AccuracyFunc(f func() null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Accuracy = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetAccuracy() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Accuracy = 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 fsLocationtrackingMods) RandomAccuracy(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAccuracyNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Creationdate(val null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) CreationdateFunc(f func() null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetCreationdate() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creationdate = 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 fsLocationtrackingMods) RandomCreationdate(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Creator(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) CreatorFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetCreator() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creator = 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 fsLocationtrackingMods) RandomCreator(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Editdate(val null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) EditdateFunc(f func() null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetEditdate() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editdate = 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 fsLocationtrackingMods) RandomEditdate(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Editor(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) EditorFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetEditor() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editor = 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 fsLocationtrackingMods) RandomEditor(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Fieldtech(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) FieldtechFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetFieldtech() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Fieldtech = 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 fsLocationtrackingMods) RandomFieldtech(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Globalid(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) GlobalidFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetGlobalid() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Globalid = 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 fsLocationtrackingMods) RandomGlobalid(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Objectid(val int32) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) ObjectidFunc(f func() int32) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetObjectid() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsLocationtrackingMods) RandomObjectid(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) CreatedDate(val null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) CreatedDateFunc(f func() null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetCreatedDate() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedDate = 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 fsLocationtrackingMods) RandomCreatedDate(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) CreatedUser(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) CreatedUserFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetCreatedUser() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedUser = 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 fsLocationtrackingMods) RandomCreatedUser(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) GeometryX(val null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) GeometryXFunc(f func() null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetGeometryX() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryX = 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 fsLocationtrackingMods) RandomGeometryX(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) GeometryY(val null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) GeometryYFunc(f func() null.Val[float64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetGeometryY() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryY = 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 fsLocationtrackingMods) RandomGeometryY(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) LastEditedDate(val null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) LastEditedDateFunc(f func() null.Val[int64]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetLastEditedDate() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedDate = 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 fsLocationtrackingMods) RandomLastEditedDate(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) LastEditedUser(val null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) LastEditedUserFunc(f func() null.Val[string]) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetLastEditedUser() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedUser = 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 fsLocationtrackingMods) RandomLastEditedUser(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsLocationtrackingMods) Updated(val time.Time) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsLocationtrackingMods) UpdatedFunc(f func() time.Time) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsLocationtrackingMods) UnsetUpdated() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsLocationtrackingMods) RandomUpdated(f *faker.Faker) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsLocationtrackingMods) WithParentsCascading() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { + if isDone, _ := fsLocationtrackingWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsLocationtrackingWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsLocationtrackingMods) WithOrganization(rel *OrganizationTemplate) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { + o.r.Organization = &fsLocationtrackingROrganizationR{ + o: rel, + } + }) +} + +func (m fsLocationtrackingMods) WithNewOrganization(mods ...OrganizationMod) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsLocationtrackingMods) WithExistingOrganization(em *models.Organization) FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { + o.r.Organization = &fsLocationtrackingROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsLocationtrackingMods) WithoutOrganization() FSLocationtrackingMod { + return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_mosquitoinspection.bob.go b/factory/fs_mosquitoinspection.bob.go new file mode 100644 index 00000000..cbbb7daf --- /dev/null +++ b/factory/fs_mosquitoinspection.bob.go @@ -0,0 +1,4026 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSMosquitoinspectionMod interface { + Apply(context.Context, *FSMosquitoinspectionTemplate) +} + +type FSMosquitoinspectionModFunc func(context.Context, *FSMosquitoinspectionTemplate) + +func (f FSMosquitoinspectionModFunc) Apply(ctx context.Context, n *FSMosquitoinspectionTemplate) { + f(ctx, n) +} + +type FSMosquitoinspectionModSlice []FSMosquitoinspectionMod + +func (mods FSMosquitoinspectionModSlice) Apply(ctx context.Context, n *FSMosquitoinspectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Actiontaken func() null.Val[string] + Activity func() null.Val[string] + Adultact func() null.Val[string] + Avetemp func() null.Val[float64] + Avglarvae func() null.Val[float64] + Avgpupae func() null.Val[float64] + Breeding func() null.Val[string] + Cbcount func() null.Val[int16] + Comments func() null.Val[string] + Containercount func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Domstage func() null.Val[string] + Eggs func() null.Val[int16] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldspecies func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Jurisdiction func() null.Val[string] + Larvaepresent func() null.Val[int16] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Lstages func() null.Val[string] + Numdips func() null.Val[int16] + Objectid func() int32 + Personalcontact func() null.Val[int16] + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Posdips func() null.Val[int16] + Positivecontainercount func() null.Val[int16] + Pupaepresent func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sdid func() null.Val[string] + Sitecond func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Tirecount func() null.Val[int16] + Totlarvae func() null.Val[int16] + Totpupae func() null.Val[int16] + Visualmonitoring func() null.Val[int16] + Vmcomments func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Adminaction func() null.Val[string] + Ptaid func() null.Val[string] + Updated func() time.Time + + r fsMosquitoinspectionR + f *Factory + + alreadyPersisted bool +} + +type fsMosquitoinspectionR struct { + Organization *fsMosquitoinspectionROrganizationR +} + +type fsMosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSMosquitoinspectionTemplate +func (o *FSMosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FSMosquitoinspectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSMosquitoinspection +// according to the relationships in the template. Nothing is inserted into the db +func (t FSMosquitoinspectionTemplate) setModelRels(o *models.FSMosquitoinspection) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSMosquitoinspectionSetter +// this does nothing with the relationship templates +func (o FSMosquitoinspectionTemplate) BuildSetter() *models.FSMosquitoinspectionSetter { + m := &models.FSMosquitoinspectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Actiontaken != nil { + val := o.Actiontaken() + m.Actiontaken = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Adultact != nil { + val := o.Adultact() + m.Adultact = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Avglarvae != nil { + val := o.Avglarvae() + m.Avglarvae = omitnull.FromNull(val) + } + if o.Avgpupae != nil { + val := o.Avgpupae() + m.Avgpupae = omitnull.FromNull(val) + } + if o.Breeding != nil { + val := o.Breeding() + m.Breeding = omitnull.FromNull(val) + } + if o.Cbcount != nil { + val := o.Cbcount() + m.Cbcount = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Containercount != nil { + val := o.Containercount() + m.Containercount = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Domstage != nil { + val := o.Domstage() + m.Domstage = omitnull.FromNull(val) + } + if o.Eggs != nil { + val := o.Eggs() + m.Eggs = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldspecies != nil { + val := o.Fieldspecies() + m.Fieldspecies = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvaepresent != nil { + val := o.Larvaepresent() + m.Larvaepresent = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Lstages != nil { + val := o.Lstages() + m.Lstages = omitnull.FromNull(val) + } + if o.Numdips != nil { + val := o.Numdips() + m.Numdips = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Personalcontact != nil { + val := o.Personalcontact() + m.Personalcontact = omitnull.FromNull(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Posdips != nil { + val := o.Posdips() + m.Posdips = omitnull.FromNull(val) + } + if o.Positivecontainercount != nil { + val := o.Positivecontainercount() + m.Positivecontainercount = omitnull.FromNull(val) + } + if o.Pupaepresent != nil { + val := o.Pupaepresent() + m.Pupaepresent = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sdid != nil { + val := o.Sdid() + m.Sdid = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Tirecount != nil { + val := o.Tirecount() + m.Tirecount = omitnull.FromNull(val) + } + if o.Totlarvae != nil { + val := o.Totlarvae() + m.Totlarvae = omitnull.FromNull(val) + } + if o.Totpupae != nil { + val := o.Totpupae() + m.Totpupae = omitnull.FromNull(val) + } + if o.Visualmonitoring != nil { + val := o.Visualmonitoring() + m.Visualmonitoring = omitnull.FromNull(val) + } + if o.Vmcomments != nil { + val := o.Vmcomments() + m.Vmcomments = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Adminaction != nil { + val := o.Adminaction() + m.Adminaction = omitnull.FromNull(val) + } + if o.Ptaid != nil { + val := o.Ptaid() + m.Ptaid = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSMosquitoinspectionSetter +// this does nothing with the relationship templates +func (o FSMosquitoinspectionTemplate) BuildManySetter(number int) []*models.FSMosquitoinspectionSetter { + m := make([]*models.FSMosquitoinspectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSMosquitoinspection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSMosquitoinspectionTemplate.Create +func (o FSMosquitoinspectionTemplate) Build() *models.FSMosquitoinspection { + m := &models.FSMosquitoinspection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Actiontaken != nil { + m.Actiontaken = o.Actiontaken() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Adultact != nil { + m.Adultact = o.Adultact() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Avglarvae != nil { + m.Avglarvae = o.Avglarvae() + } + if o.Avgpupae != nil { + m.Avgpupae = o.Avgpupae() + } + if o.Breeding != nil { + m.Breeding = o.Breeding() + } + if o.Cbcount != nil { + m.Cbcount = o.Cbcount() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Containercount != nil { + m.Containercount = o.Containercount() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Domstage != nil { + m.Domstage = o.Domstage() + } + if o.Eggs != nil { + m.Eggs = o.Eggs() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldspecies != nil { + m.Fieldspecies = o.Fieldspecies() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvaepresent != nil { + m.Larvaepresent = o.Larvaepresent() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Lstages != nil { + m.Lstages = o.Lstages() + } + if o.Numdips != nil { + m.Numdips = o.Numdips() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Personalcontact != nil { + m.Personalcontact = o.Personalcontact() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Posdips != nil { + m.Posdips = o.Posdips() + } + if o.Positivecontainercount != nil { + m.Positivecontainercount = o.Positivecontainercount() + } + if o.Pupaepresent != nil { + m.Pupaepresent = o.Pupaepresent() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sdid != nil { + m.Sdid = o.Sdid() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Tirecount != nil { + m.Tirecount = o.Tirecount() + } + if o.Totlarvae != nil { + m.Totlarvae = o.Totlarvae() + } + if o.Totpupae != nil { + m.Totpupae = o.Totpupae() + } + if o.Visualmonitoring != nil { + m.Visualmonitoring = o.Visualmonitoring() + } + if o.Vmcomments != nil { + m.Vmcomments = o.Vmcomments() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Adminaction != nil { + m.Adminaction = o.Adminaction() + } + if o.Ptaid != nil { + m.Ptaid = o.Ptaid() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSMosquitoinspectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSMosquitoinspectionTemplate.CreateMany +func (o FSMosquitoinspectionTemplate) BuildMany(number int) models.FSMosquitoinspectionSlice { + m := make(models.FSMosquitoinspectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSMosquitoinspection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsMosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSMosquitoinspection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSMosquitoinspection(opt) + + m, err := models.FSMosquitoinspections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsMosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSMosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSMosquitoinspection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsMosquitoinspection 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 *FSMosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSMosquitoinspection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsMosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSMosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSMosquitoinspectionSlice, error) { + var err error + m := make(models.FSMosquitoinspectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsMosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSMosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSMosquitoinspectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsMosquitoinspections 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 FSMosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSMosquitoinspectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSMosquitoinspection has methods that act as mods for the FSMosquitoinspectionTemplate +var FSMosquitoinspectionMods fsMosquitoinspectionMods + +type fsMosquitoinspectionMods struct{} + +func (m fsMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModSlice{ + FSMosquitoinspectionMods.RandomOrganizationID(f), + FSMosquitoinspectionMods.RandomActiontaken(f), + FSMosquitoinspectionMods.RandomActivity(f), + FSMosquitoinspectionMods.RandomAdultact(f), + FSMosquitoinspectionMods.RandomAvetemp(f), + FSMosquitoinspectionMods.RandomAvglarvae(f), + FSMosquitoinspectionMods.RandomAvgpupae(f), + FSMosquitoinspectionMods.RandomBreeding(f), + FSMosquitoinspectionMods.RandomCbcount(f), + FSMosquitoinspectionMods.RandomComments(f), + FSMosquitoinspectionMods.RandomContainercount(f), + FSMosquitoinspectionMods.RandomCreationdate(f), + FSMosquitoinspectionMods.RandomCreator(f), + FSMosquitoinspectionMods.RandomDomstage(f), + FSMosquitoinspectionMods.RandomEggs(f), + FSMosquitoinspectionMods.RandomEnddatetime(f), + FSMosquitoinspectionMods.RandomEditdate(f), + FSMosquitoinspectionMods.RandomEditor(f), + FSMosquitoinspectionMods.RandomFieldspecies(f), + FSMosquitoinspectionMods.RandomFieldtech(f), + FSMosquitoinspectionMods.RandomGlobalid(f), + FSMosquitoinspectionMods.RandomJurisdiction(f), + FSMosquitoinspectionMods.RandomLarvaepresent(f), + FSMosquitoinspectionMods.RandomLinelocid(f), + FSMosquitoinspectionMods.RandomLocationname(f), + FSMosquitoinspectionMods.RandomLstages(f), + FSMosquitoinspectionMods.RandomNumdips(f), + FSMosquitoinspectionMods.RandomObjectid(f), + FSMosquitoinspectionMods.RandomPersonalcontact(f), + FSMosquitoinspectionMods.RandomPointlocid(f), + FSMosquitoinspectionMods.RandomPolygonlocid(f), + FSMosquitoinspectionMods.RandomPosdips(f), + FSMosquitoinspectionMods.RandomPositivecontainercount(f), + FSMosquitoinspectionMods.RandomPupaepresent(f), + FSMosquitoinspectionMods.RandomRaingauge(f), + FSMosquitoinspectionMods.RandomRecordstatus(f), + FSMosquitoinspectionMods.RandomReviewed(f), + FSMosquitoinspectionMods.RandomReviewedby(f), + FSMosquitoinspectionMods.RandomRevieweddate(f), + FSMosquitoinspectionMods.RandomSdid(f), + FSMosquitoinspectionMods.RandomSitecond(f), + FSMosquitoinspectionMods.RandomSrid(f), + FSMosquitoinspectionMods.RandomStartdatetime(f), + FSMosquitoinspectionMods.RandomTirecount(f), + FSMosquitoinspectionMods.RandomTotlarvae(f), + FSMosquitoinspectionMods.RandomTotpupae(f), + FSMosquitoinspectionMods.RandomVisualmonitoring(f), + FSMosquitoinspectionMods.RandomVmcomments(f), + FSMosquitoinspectionMods.RandomWinddir(f), + FSMosquitoinspectionMods.RandomWindspeed(f), + FSMosquitoinspectionMods.RandomZone(f), + FSMosquitoinspectionMods.RandomZone2(f), + FSMosquitoinspectionMods.RandomCreatedDate(f), + FSMosquitoinspectionMods.RandomCreatedUser(f), + FSMosquitoinspectionMods.RandomGeometryX(f), + FSMosquitoinspectionMods.RandomGeometryY(f), + FSMosquitoinspectionMods.RandomLastEditedDate(f), + FSMosquitoinspectionMods.RandomLastEditedUser(f), + FSMosquitoinspectionMods.RandomAdminaction(f), + FSMosquitoinspectionMods.RandomPtaid(f), + FSMosquitoinspectionMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetOrganizationID() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Actiontaken(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Actiontaken = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetActiontaken() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Actiontaken = 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 fsMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActiontakenNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Activity(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetActivity() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Activity = 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 fsMosquitoinspectionMods) RandomActivity(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Adultact(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adultact = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetAdultact() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adultact = 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 fsMosquitoinspectionMods) RandomAdultact(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAdultactNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Avetemp(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetAvetemp() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avetemp = 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 fsMosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Avglarvae(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) AvglarvaeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avglarvae = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetAvglarvae() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avglarvae = 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 fsMosquitoinspectionMods) RandomAvglarvae(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvglarvaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Avgpupae(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) AvgpupaeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avgpupae = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetAvgpupae() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avgpupae = 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 fsMosquitoinspectionMods) RandomAvgpupae(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvgpupaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Breeding(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Breeding = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetBreeding() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Breeding = 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 fsMosquitoinspectionMods) RandomBreeding(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBreedingNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Cbcount(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CbcountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Cbcount = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetCbcount() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Cbcount = 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 fsMosquitoinspectionMods) RandomCbcount(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Comments(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetComments() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Comments = 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 fsMosquitoinspectionMods) RandomComments(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Containercount(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ContainercountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Containercount = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetContainercount() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Containercount = 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 fsMosquitoinspectionMods) RandomContainercount(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Creationdate(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetCreationdate() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creationdate = 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 fsMosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Creator(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetCreator() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creator = 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 fsMosquitoinspectionMods) RandomCreator(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Domstage(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Domstage = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetDomstage() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Domstage = 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 fsMosquitoinspectionMods) RandomDomstage(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDomstageNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Eggs(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) EggsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Eggs = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetEggs() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Eggs = 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 fsMosquitoinspectionMods) RandomEggs(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomEggsNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Enddatetime(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetEnddatetime() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Enddatetime = 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 fsMosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Editdate(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetEditdate() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editdate = 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 fsMosquitoinspectionMods) RandomEditdate(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Editor(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetEditor() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editor = 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 fsMosquitoinspectionMods) RandomEditor(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Fieldspecies(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldspecies = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetFieldspecies() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldspecies = 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 fsMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldspeciesNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Fieldtech(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetFieldtech() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldtech = 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 fsMosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Globalid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetGlobalid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Globalid = 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 fsMosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Jurisdiction(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) JurisdictionFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetJurisdiction() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Jurisdiction = 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 fsMosquitoinspectionMods) RandomJurisdiction(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Larvaepresent = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLarvaepresent() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Larvaepresent = 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 fsMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Linelocid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLinelocid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Linelocid = 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 fsMosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Locationname(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLocationname() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Locationname = 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 fsMosquitoinspectionMods) RandomLocationname(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Lstages(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LstagesFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Lstages = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLstages() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Lstages = 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 fsMosquitoinspectionMods) RandomLstages(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLstagesNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Numdips(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) NumdipsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Numdips = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetNumdips() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Numdips = 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 fsMosquitoinspectionMods) RandomNumdips(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNumdipsNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Objectid(val int32) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ObjectidFunc(f func() int32) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetObjectid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsMosquitoinspectionMods) RandomObjectid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Personalcontact(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Personalcontact = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPersonalcontact() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Personalcontact = 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 fsMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPersonalcontactNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Pointlocid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPointlocid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pointlocid = 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 fsMosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Polygonlocid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPolygonlocid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Polygonlocid = 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 fsMosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Posdips(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Posdips = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPosdips() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Posdips = 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 fsMosquitoinspectionMods) RandomPosdips(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Positivecontainercount(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PositivecontainercountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Positivecontainercount = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPositivecontainercount() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Positivecontainercount = 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 fsMosquitoinspectionMods) RandomPositivecontainercount(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPositivecontainercountNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pupaepresent = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPupaepresent() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pupaepresent = 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 fsMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPupaepresentNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Raingauge(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetRaingauge() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Raingauge = 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 fsMosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Recordstatus(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetRecordstatus() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Recordstatus = 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 fsMosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Reviewed(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetReviewed() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewed = 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 fsMosquitoinspectionMods) RandomReviewed(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Reviewedby(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetReviewedby() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewedby = 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 fsMosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Revieweddate(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetRevieweddate() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Revieweddate = 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 fsMosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Sdid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) SdidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sdid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetSdid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sdid = 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 fsMosquitoinspectionMods) RandomSdid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSdidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Sitecond(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetSitecond() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sitecond = 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 fsMosquitoinspectionMods) RandomSitecond(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Srid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) SridFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetSrid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Srid = 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 fsMosquitoinspectionMods) RandomSrid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Startdatetime(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetStartdatetime() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Startdatetime = 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 fsMosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Tirecount(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) TirecountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Tirecount = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetTirecount() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Tirecount = 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 fsMosquitoinspectionMods) RandomTirecount(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Totlarvae(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) TotlarvaeFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totlarvae = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetTotlarvae() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totlarvae = 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 fsMosquitoinspectionMods) RandomTotlarvae(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTotlarvaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Totpupae(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) TotpupaeFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totpupae = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetTotpupae() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totpupae = 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 fsMosquitoinspectionMods) RandomTotpupae(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTotpupaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Visualmonitoring = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetVisualmonitoring() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Visualmonitoring = 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 fsMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomVisualmonitoringNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Vmcomments(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) VmcommentsFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Vmcomments = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetVmcomments() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Vmcomments = 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 fsMosquitoinspectionMods) RandomVmcomments(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVmcommentsNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Winddir(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetWinddir() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Winddir = 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 fsMosquitoinspectionMods) RandomWinddir(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Windspeed(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetWindspeed() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Windspeed = 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 fsMosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Zone(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetZone() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone = 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 fsMosquitoinspectionMods) RandomZone(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Zone2(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetZone2() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone2 = 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 fsMosquitoinspectionMods) RandomZone2(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) CreatedDate(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetCreatedDate() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedDate = 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 fsMosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) CreatedUser(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetCreatedUser() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedUser = 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 fsMosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) GeometryX(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetGeometryX() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryX = 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 fsMosquitoinspectionMods) RandomGeometryX(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) GeometryY(val null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetGeometryY() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryY = 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 fsMosquitoinspectionMods) RandomGeometryY(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) LastEditedDate(val null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLastEditedDate() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedDate = 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 fsMosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) LastEditedUser(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetLastEditedUser() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedUser = 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 fsMosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Adminaction(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adminaction = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetAdminaction() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adminaction = 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 fsMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAdminactionNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Ptaid(val null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) PtaidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Ptaid = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetPtaid() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Ptaid = 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 fsMosquitoinspectionMods) RandomPtaid(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPtaidNotNull(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsMosquitoinspectionMods) Updated(val time.Time) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsMosquitoinspectionMods) UpdatedFunc(f func() time.Time) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsMosquitoinspectionMods) UnsetUpdated() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsMosquitoinspectionMods) RandomUpdated(f *faker.Faker) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsMosquitoinspectionMods) WithParentsCascading() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { + if isDone, _ := fsMosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsMosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsMosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { + o.r.Organization = &fsMosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m fsMosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsMosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { + o.r.Organization = &fsMosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsMosquitoinspectionMods) WithoutOrganization() FSMosquitoinspectionMod { + return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_pointlocation.bob.go b/factory/fs_pointlocation.bob.go new file mode 100644 index 00000000..97115ddc --- /dev/null +++ b/factory/fs_pointlocation.bob.go @@ -0,0 +1,3220 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSPointlocationMod interface { + Apply(context.Context, *FSPointlocationTemplate) +} + +type FSPointlocationModFunc func(context.Context, *FSPointlocationTemplate) + +func (f FSPointlocationModFunc) Apply(ctx context.Context, n *FSPointlocationTemplate) { + f(ctx, n) +} + +type FSPointlocationModSlice []FSPointlocationMod + +func (mods FSPointlocationModSlice) Apply(ctx context.Context, n *FSPointlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Stype func() null.Val[string] + Symbology func() null.Val[string] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + X func() null.Val[float64] + Y func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Assignedtech func() null.Val[string] + DeactivateReason func() null.Val[string] + Scalarpriority func() null.Val[int64] + Sourcestatus func() null.Val[string] + Updated func() time.Time + + r fsPointlocationR + f *Factory + + alreadyPersisted bool +} + +type fsPointlocationR struct { + Organization *fsPointlocationROrganizationR +} + +type fsPointlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSPointlocationTemplate +func (o *FSPointlocationTemplate) Apply(ctx context.Context, mods ...FSPointlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSPointlocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSPointlocationSetter +// this does nothing with the relationship templates +func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter { + m := &models.FSPointlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Stype != nil { + val := o.Stype() + m.Stype = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.X != nil { + val := o.X() + m.X = omitnull.FromNull(val) + } + if o.Y != nil { + val := o.Y() + m.Y = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Assignedtech != nil { + val := o.Assignedtech() + m.Assignedtech = omitnull.FromNull(val) + } + if o.DeactivateReason != nil { + val := o.DeactivateReason() + m.DeactivateReason = omitnull.FromNull(val) + } + if o.Scalarpriority != nil { + val := o.Scalarpriority() + m.Scalarpriority = omitnull.FromNull(val) + } + if o.Sourcestatus != nil { + val := o.Sourcestatus() + m.Sourcestatus = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSPointlocationSetter +// this does nothing with the relationship templates +func (o FSPointlocationTemplate) BuildManySetter(number int) []*models.FSPointlocationSetter { + m := make([]*models.FSPointlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSPointlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPointlocationTemplate.Create +func (o FSPointlocationTemplate) Build() *models.FSPointlocation { + m := &models.FSPointlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Stype != nil { + m.Stype = o.Stype() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.X != nil { + m.X = o.X() + } + if o.Y != nil { + m.Y = o.Y() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Assignedtech != nil { + m.Assignedtech = o.Assignedtech() + } + if o.DeactivateReason != nil { + m.DeactivateReason = o.DeactivateReason() + } + if o.Scalarpriority != nil { + m.Scalarpriority = o.Scalarpriority() + } + if o.Sourcestatus != nil { + m.Sourcestatus = o.Sourcestatus() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSPointlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPointlocationTemplate.CreateMany +func (o FSPointlocationTemplate) BuildMany(number int) models.FSPointlocationSlice { + m := make(models.FSPointlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSPointlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsPointlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPointlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSPointlocation(opt) + + m, err := models.FSPointlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsPointlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSPointlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPointlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsPointlocation 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 *FSPointlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPointlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsPointlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSPointlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPointlocationSlice, error) { + var err error + m := make(models.FSPointlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsPointlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSPointlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPointlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsPointlocations 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 FSPointlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPointlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSPointlocation has methods that act as mods for the FSPointlocationTemplate +var FSPointlocationMods fsPointlocationMods + +type fsPointlocationMods struct{} + +func (m fsPointlocationMods) RandomizeAllColumns(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModSlice{ + FSPointlocationMods.RandomOrganizationID(f), + FSPointlocationMods.RandomAccessdesc(f), + FSPointlocationMods.RandomActive(f), + FSPointlocationMods.RandomComments(f), + FSPointlocationMods.RandomCreationdate(f), + FSPointlocationMods.RandomCreator(f), + FSPointlocationMods.RandomDescription(f), + FSPointlocationMods.RandomExternalid(f), + FSPointlocationMods.RandomEditdate(f), + FSPointlocationMods.RandomEditor(f), + FSPointlocationMods.RandomGlobalid(f), + FSPointlocationMods.RandomHabitat(f), + FSPointlocationMods.RandomJurisdiction(f), + FSPointlocationMods.RandomLarvinspectinterval(f), + FSPointlocationMods.RandomLastinspectactiontaken(f), + FSPointlocationMods.RandomLastinspectactivity(f), + FSPointlocationMods.RandomLastinspectavglarvae(f), + FSPointlocationMods.RandomLastinspectavgpupae(f), + FSPointlocationMods.RandomLastinspectbreeding(f), + FSPointlocationMods.RandomLastinspectconditions(f), + FSPointlocationMods.RandomLastinspectdate(f), + FSPointlocationMods.RandomLastinspectfieldspecies(f), + FSPointlocationMods.RandomLastinspectlstages(f), + FSPointlocationMods.RandomLasttreatactivity(f), + FSPointlocationMods.RandomLasttreatdate(f), + FSPointlocationMods.RandomLasttreatproduct(f), + FSPointlocationMods.RandomLasttreatqty(f), + FSPointlocationMods.RandomLasttreatqtyunit(f), + FSPointlocationMods.RandomLocationnumber(f), + FSPointlocationMods.RandomName(f), + FSPointlocationMods.RandomNextactiondatescheduled(f), + FSPointlocationMods.RandomObjectid(f), + FSPointlocationMods.RandomPriority(f), + FSPointlocationMods.RandomStype(f), + FSPointlocationMods.RandomSymbology(f), + FSPointlocationMods.RandomUsetype(f), + FSPointlocationMods.RandomWaterorigin(f), + FSPointlocationMods.RandomX(f), + FSPointlocationMods.RandomY(f), + FSPointlocationMods.RandomZone(f), + FSPointlocationMods.RandomZone2(f), + FSPointlocationMods.RandomGeometryX(f), + FSPointlocationMods.RandomGeometryY(f), + FSPointlocationMods.RandomAssignedtech(f), + FSPointlocationMods.RandomDeactivateReason(f), + FSPointlocationMods.RandomScalarpriority(f), + FSPointlocationMods.RandomSourcestatus(f), + FSPointlocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsPointlocationMods) OrganizationID(val null.Val[int32]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetOrganizationID() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Accessdesc(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) AccessdescFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetAccessdesc() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Accessdesc = 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 fsPointlocationMods) RandomAccessdesc(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Active(val null.Val[int16]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) ActiveFunc(f func() null.Val[int16]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetActive() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Active = 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 fsPointlocationMods) RandomActive(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Comments(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) CommentsFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetComments() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Comments = 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 fsPointlocationMods) RandomComments(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Creationdate(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) CreationdateFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetCreationdate() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creationdate = 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 fsPointlocationMods) RandomCreationdate(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Creator(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) CreatorFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetCreator() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creator = 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 fsPointlocationMods) RandomCreator(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Description(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) DescriptionFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetDescription() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Description = 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 fsPointlocationMods) RandomDescription(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Externalid(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) ExternalidFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetExternalid() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Externalid = 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 fsPointlocationMods) RandomExternalid(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Editdate(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) EditdateFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetEditdate() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editdate = 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 fsPointlocationMods) RandomEditdate(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Editor(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) EditorFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetEditor() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editor = 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 fsPointlocationMods) RandomEditor(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Globalid(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) GlobalidFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetGlobalid() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Globalid = 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 fsPointlocationMods) RandomGlobalid(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Habitat(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) HabitatFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetHabitat() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Habitat = 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 fsPointlocationMods) RandomHabitat(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Jurisdiction(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) JurisdictionFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetJurisdiction() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Jurisdiction = 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 fsPointlocationMods) RandomJurisdiction(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Larvinspectinterval(val null.Val[int16]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLarvinspectinterval() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Larvinspectinterval = 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 fsPointlocationMods) RandomLarvinspectinterval(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectactiontaken(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectactiontaken() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactiontaken = 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 fsPointlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectactivity(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectactivity() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactivity = 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 fsPointlocationMods) RandomLastinspectactivity(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectavglarvae(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectavglarvae() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavglarvae = 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 fsPointlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectavgpupae(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectavgpupae() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavgpupae = 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 fsPointlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectbreeding(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectbreeding() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectbreeding = 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 fsPointlocationMods) RandomLastinspectbreeding(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectconditions(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectconditions() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectconditions = 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 fsPointlocationMods) RandomLastinspectconditions(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectdate(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectdate() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectdate = 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 fsPointlocationMods) RandomLastinspectdate(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectfieldspecies(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectfieldspecies() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectfieldspecies = 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 fsPointlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lastinspectlstages(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLastinspectlstages() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectlstages = 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 fsPointlocationMods) RandomLastinspectlstages(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lasttreatactivity(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLasttreatactivity() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatactivity = 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 fsPointlocationMods) RandomLasttreatactivity(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lasttreatdate(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLasttreatdate() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatdate = 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 fsPointlocationMods) RandomLasttreatdate(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lasttreatproduct(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LasttreatproductFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLasttreatproduct() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatproduct = 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 fsPointlocationMods) RandomLasttreatproduct(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lasttreatqty(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLasttreatqty() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqty = 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 fsPointlocationMods) RandomLasttreatqty(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Lasttreatqtyunit(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLasttreatqtyunit() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqtyunit = 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 fsPointlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Locationnumber(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetLocationnumber() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Locationnumber = 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 fsPointlocationMods) RandomLocationnumber(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Name(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) NameFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetName() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Name = 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 fsPointlocationMods) RandomName(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetNextactiondatescheduled() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Nextactiondatescheduled = 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 fsPointlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Objectid(val int32) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) ObjectidFunc(f func() int32) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetObjectid() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPointlocationMods) RandomObjectid(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Priority(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) PriorityFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetPriority() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Priority = 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 fsPointlocationMods) RandomPriority(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Stype(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Stype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) StypeFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Stype = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetStype() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Stype = 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 fsPointlocationMods) RandomStype(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Stype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomStypeNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Stype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Symbology(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) SymbologyFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetSymbology() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Symbology = 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 fsPointlocationMods) RandomSymbology(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Usetype(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) UsetypeFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetUsetype() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Usetype = 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 fsPointlocationMods) RandomUsetype(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Waterorigin(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) WateroriginFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetWaterorigin() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Waterorigin = 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 fsPointlocationMods) RandomWaterorigin(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) X(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.X = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) XFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.X = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetX() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.X = 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 fsPointlocationMods) RandomX(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.X = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomXNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.X = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Y(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Y = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) YFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Y = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetY() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Y = 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 fsPointlocationMods) RandomY(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Y = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomYNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Y = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Zone(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) ZoneFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetZone() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone = 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 fsPointlocationMods) RandomZone(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Zone2(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) Zone2Func(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetZone2() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone2 = 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 fsPointlocationMods) RandomZone2(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) GeometryX(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) GeometryXFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetGeometryX() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryX = 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 fsPointlocationMods) RandomGeometryX(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) GeometryY(val null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) GeometryYFunc(f func() null.Val[float64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetGeometryY() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryY = 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 fsPointlocationMods) RandomGeometryY(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Assignedtech(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) AssignedtechFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Assignedtech = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetAssignedtech() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Assignedtech = 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 fsPointlocationMods) RandomAssignedtech(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAssignedtechNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) DeactivateReason(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.DeactivateReason = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetDeactivateReason() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.DeactivateReason = 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 fsPointlocationMods) RandomDeactivateReason(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDeactivateReasonNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Scalarpriority(val null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) ScalarpriorityFunc(f func() null.Val[int64]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Scalarpriority = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetScalarpriority() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Scalarpriority = 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 fsPointlocationMods) RandomScalarpriority(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomScalarpriorityNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Sourcestatus(val null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) SourcestatusFunc(f func() null.Val[string]) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Sourcestatus = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetSourcestatus() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Sourcestatus = 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 fsPointlocationMods) RandomSourcestatus(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourcestatusNotNull(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPointlocationMods) Updated(val time.Time) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsPointlocationMods) UpdatedFunc(f func() time.Time) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsPointlocationMods) UnsetUpdated() FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPointlocationMods) RandomUpdated(f *faker.Faker) FSPointlocationMod { + return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsPointlocationMods) WithParentsCascading() FSPointlocationMod { + return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { + if isDone, _ := fsPointlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsPointlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsPointlocationMods) WithOrganization(rel *OrganizationTemplate) FSPointlocationMod { + return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { + o.r.Organization = &fsPointlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsPointlocationMods) WithNewOrganization(mods ...OrganizationMod) FSPointlocationMod { + return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsPointlocationMods) WithExistingOrganization(em *models.Organization) FSPointlocationMod { + return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { + o.r.Organization = &fsPointlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsPointlocationMods) WithoutOrganization() FSPointlocationMod { + return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_polygonlocation.bob.go b/factory/fs_polygonlocation.bob.go new file mode 100644 index 00000000..7b58260e --- /dev/null +++ b/factory/fs_polygonlocation.bob.go @@ -0,0 +1,3096 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSPolygonlocationMod interface { + Apply(context.Context, *FSPolygonlocationTemplate) +} + +type FSPolygonlocationModFunc func(context.Context, *FSPolygonlocationTemplate) + +func (f FSPolygonlocationModFunc) Apply(ctx context.Context, n *FSPolygonlocationTemplate) { + f(ctx, n) +} + +type FSPolygonlocationModSlice []FSPolygonlocationMod + +func (mods FSPolygonlocationModSlice) Apply(ctx context.Context, n *FSPolygonlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Acres func() null.Val[float64] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Filter func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Hectares func() null.Val[float64] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Updated func() time.Time + + r fsPolygonlocationR + f *Factory + + alreadyPersisted bool +} + +type fsPolygonlocationR struct { + Organization *fsPolygonlocationROrganizationR +} + +type fsPolygonlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSPolygonlocationTemplate +func (o *FSPolygonlocationTemplate) Apply(ctx context.Context, mods ...FSPolygonlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSPolygonlocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSPolygonlocationSetter +// this does nothing with the relationship templates +func (o FSPolygonlocationTemplate) BuildSetter() *models.FSPolygonlocationSetter { + m := &models.FSPolygonlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Filter != nil { + val := o.Filter() + m.Filter = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSPolygonlocationSetter +// this does nothing with the relationship templates +func (o FSPolygonlocationTemplate) BuildManySetter(number int) []*models.FSPolygonlocationSetter { + m := make([]*models.FSPolygonlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSPolygonlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPolygonlocationTemplate.Create +func (o FSPolygonlocationTemplate) Build() *models.FSPolygonlocation { + m := &models.FSPolygonlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Filter != nil { + m.Filter = o.Filter() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSPolygonlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPolygonlocationTemplate.CreateMany +func (o FSPolygonlocationTemplate) BuildMany(number int) models.FSPolygonlocationSlice { + m := make(models.FSPolygonlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSPolygonlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsPolygonlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPolygonlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSPolygonlocation(opt) + + m, err := models.FSPolygonlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsPolygonlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSPolygonlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPolygonlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsPolygonlocation 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 *FSPolygonlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPolygonlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsPolygonlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSPolygonlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPolygonlocationSlice, error) { + var err error + m := make(models.FSPolygonlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsPolygonlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSPolygonlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPolygonlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsPolygonlocations 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 FSPolygonlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPolygonlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSPolygonlocation has methods that act as mods for the FSPolygonlocationTemplate +var FSPolygonlocationMods fsPolygonlocationMods + +type fsPolygonlocationMods struct{} + +func (m fsPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModSlice{ + FSPolygonlocationMods.RandomOrganizationID(f), + FSPolygonlocationMods.RandomAccessdesc(f), + FSPolygonlocationMods.RandomAcres(f), + FSPolygonlocationMods.RandomActive(f), + FSPolygonlocationMods.RandomComments(f), + FSPolygonlocationMods.RandomCreationdate(f), + FSPolygonlocationMods.RandomCreator(f), + FSPolygonlocationMods.RandomDescription(f), + FSPolygonlocationMods.RandomExternalid(f), + FSPolygonlocationMods.RandomEditdate(f), + FSPolygonlocationMods.RandomEditor(f), + FSPolygonlocationMods.RandomFilter(f), + FSPolygonlocationMods.RandomGlobalid(f), + FSPolygonlocationMods.RandomHabitat(f), + FSPolygonlocationMods.RandomHectares(f), + FSPolygonlocationMods.RandomJurisdiction(f), + FSPolygonlocationMods.RandomLarvinspectinterval(f), + FSPolygonlocationMods.RandomLastinspectactiontaken(f), + FSPolygonlocationMods.RandomLastinspectactivity(f), + FSPolygonlocationMods.RandomLastinspectavglarvae(f), + FSPolygonlocationMods.RandomLastinspectavgpupae(f), + FSPolygonlocationMods.RandomLastinspectbreeding(f), + FSPolygonlocationMods.RandomLastinspectconditions(f), + FSPolygonlocationMods.RandomLastinspectdate(f), + FSPolygonlocationMods.RandomLastinspectfieldspecies(f), + FSPolygonlocationMods.RandomLastinspectlstages(f), + FSPolygonlocationMods.RandomLasttreatactivity(f), + FSPolygonlocationMods.RandomLasttreatdate(f), + FSPolygonlocationMods.RandomLasttreatproduct(f), + FSPolygonlocationMods.RandomLasttreatqty(f), + FSPolygonlocationMods.RandomLasttreatqtyunit(f), + FSPolygonlocationMods.RandomLocationnumber(f), + FSPolygonlocationMods.RandomName(f), + FSPolygonlocationMods.RandomNextactiondatescheduled(f), + FSPolygonlocationMods.RandomObjectid(f), + FSPolygonlocationMods.RandomPriority(f), + FSPolygonlocationMods.RandomSymbology(f), + FSPolygonlocationMods.RandomShapeArea(f), + FSPolygonlocationMods.RandomShapeLength(f), + FSPolygonlocationMods.RandomUsetype(f), + FSPolygonlocationMods.RandomWaterorigin(f), + FSPolygonlocationMods.RandomZone(f), + FSPolygonlocationMods.RandomZone2(f), + FSPolygonlocationMods.RandomGeometryX(f), + FSPolygonlocationMods.RandomGeometryY(f), + FSPolygonlocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) OrganizationID(val null.Val[int32]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetOrganizationID() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Accessdesc(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) AccessdescFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetAccessdesc() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Accessdesc = 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 fsPolygonlocationMods) RandomAccessdesc(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Acres(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) AcresFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetAcres() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Acres = 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 fsPolygonlocationMods) RandomAcres(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Active(val null.Val[int16]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetActive() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Active = 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 fsPolygonlocationMods) RandomActive(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Comments(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) CommentsFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetComments() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Comments = 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 fsPolygonlocationMods) RandomComments(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Creationdate(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) CreationdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetCreationdate() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creationdate = 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 fsPolygonlocationMods) RandomCreationdate(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Creator(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) CreatorFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetCreator() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creator = 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 fsPolygonlocationMods) RandomCreator(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Description(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) DescriptionFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetDescription() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Description = 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 fsPolygonlocationMods) RandomDescription(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Externalid(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ExternalidFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetExternalid() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Externalid = 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 fsPolygonlocationMods) RandomExternalid(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Editdate(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) EditdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetEditdate() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editdate = 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 fsPolygonlocationMods) RandomEditdate(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Editor(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) EditorFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetEditor() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editor = 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 fsPolygonlocationMods) RandomEditor(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Filter(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) FilterFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Filter = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetFilter() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Filter = 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 fsPolygonlocationMods) RandomFilter(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFilterNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Globalid(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) GlobalidFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetGlobalid() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Globalid = 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 fsPolygonlocationMods) RandomGlobalid(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Habitat(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) HabitatFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetHabitat() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Habitat = 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 fsPolygonlocationMods) RandomHabitat(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Hectares(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) HectaresFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetHectares() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Hectares = 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 fsPolygonlocationMods) RandomHectares(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Jurisdiction(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) JurisdictionFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetJurisdiction() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Jurisdiction = 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 fsPolygonlocationMods) RandomJurisdiction(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Larvinspectinterval(val null.Val[int16]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLarvinspectinterval() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Larvinspectinterval = 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 fsPolygonlocationMods) RandomLarvinspectinterval(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectactiontaken(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectactiontaken() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactiontaken = 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 fsPolygonlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectactivity(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectactivity() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactivity = 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 fsPolygonlocationMods) RandomLastinspectactivity(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectavglarvae(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectavglarvae() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavglarvae = 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 fsPolygonlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectavgpupae(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectavgpupae() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavgpupae = 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 fsPolygonlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectbreeding(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectbreeding() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectbreeding = 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 fsPolygonlocationMods) RandomLastinspectbreeding(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectconditions(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectconditions() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectconditions = 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 fsPolygonlocationMods) RandomLastinspectconditions(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectdate(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectdate() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectdate = 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 fsPolygonlocationMods) RandomLastinspectdate(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectfieldspecies(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectfieldspecies() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectfieldspecies = 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 fsPolygonlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lastinspectlstages(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLastinspectlstages() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectlstages = 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 fsPolygonlocationMods) RandomLastinspectlstages(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lasttreatactivity(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLasttreatactivity() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatactivity = 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 fsPolygonlocationMods) RandomLasttreatactivity(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lasttreatdate(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLasttreatdate() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatdate = 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 fsPolygonlocationMods) RandomLasttreatdate(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lasttreatproduct(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LasttreatproductFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLasttreatproduct() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatproduct = 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 fsPolygonlocationMods) RandomLasttreatproduct(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lasttreatqty(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLasttreatqty() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqty = 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 fsPolygonlocationMods) RandomLasttreatqty(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Lasttreatqtyunit(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLasttreatqtyunit() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqtyunit = 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 fsPolygonlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Locationnumber(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetLocationnumber() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Locationnumber = 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 fsPolygonlocationMods) RandomLocationnumber(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Name(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) NameFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetName() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Name = 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 fsPolygonlocationMods) RandomName(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetNextactiondatescheduled() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Nextactiondatescheduled = 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 fsPolygonlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Objectid(val int32) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ObjectidFunc(f func() int32) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetObjectid() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPolygonlocationMods) RandomObjectid(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Priority(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) PriorityFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetPriority() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Priority = 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 fsPolygonlocationMods) RandomPriority(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Symbology(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetSymbology() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Symbology = 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 fsPolygonlocationMods) RandomSymbology(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) ShapeArea(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ShapeAreaFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetShapeArea() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeArea = 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 fsPolygonlocationMods) RandomShapeArea(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) ShapeLength(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ShapeLengthFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetShapeLength() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeLength = 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 fsPolygonlocationMods) RandomShapeLength(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Usetype(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetUsetype() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Usetype = 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 fsPolygonlocationMods) RandomUsetype(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Waterorigin(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetWaterorigin() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Waterorigin = 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 fsPolygonlocationMods) RandomWaterorigin(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Zone(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) ZoneFunc(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetZone() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone = 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 fsPolygonlocationMods) RandomZone(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Zone2(val null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) Zone2Func(f func() null.Val[string]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetZone2() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone2 = 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 fsPolygonlocationMods) RandomZone2(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) GeometryX(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) GeometryXFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetGeometryX() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryX = 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 fsPolygonlocationMods) RandomGeometryX(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) GeometryY(val null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) GeometryYFunc(f func() null.Val[float64]) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetGeometryY() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryY = 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 fsPolygonlocationMods) RandomGeometryY(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPolygonlocationMods) Updated(val time.Time) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsPolygonlocationMods) UpdatedFunc(f func() time.Time) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsPolygonlocationMods) UnsetUpdated() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPolygonlocationMods) RandomUpdated(f *faker.Faker) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsPolygonlocationMods) WithParentsCascading() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { + if isDone, _ := fsPolygonlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsPolygonlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsPolygonlocationMods) WithOrganization(rel *OrganizationTemplate) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { + o.r.Organization = &fsPolygonlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsPolygonlocationMods) WithNewOrganization(mods ...OrganizationMod) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsPolygonlocationMods) WithExistingOrganization(em *models.Organization) FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { + o.r.Organization = &fsPolygonlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsPolygonlocationMods) WithoutOrganization() FSPolygonlocationMod { + return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_pool.bob.go b/factory/fs_pool.bob.go new file mode 100644 index 00000000..fb12a727 --- /dev/null +++ b/factory/fs_pool.bob.go @@ -0,0 +1,2228 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSPoolMod interface { + Apply(context.Context, *FSPoolTemplate) +} + +type FSPoolModFunc func(context.Context, *FSPoolTemplate) + +func (f FSPoolModFunc) Apply(ctx context.Context, n *FSPoolTemplate) { + f(ctx, n) +} + +type FSPoolModSlice []FSPoolMod + +func (mods FSPoolModSlice) Apply(ctx context.Context, n *FSPoolTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datesent func() null.Val[int64] + Datetested func() null.Val[int64] + Diseasepos func() null.Val[string] + Diseasetested func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Lab func() null.Val[string] + LabID func() null.Val[string] + Objectid func() int32 + Poolyear func() null.Val[int16] + Processed func() null.Val[int16] + Sampleid func() null.Val[string] + Survtech func() null.Val[string] + Testmethod func() null.Val[string] + Testtech func() null.Val[string] + TrapdataID func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Vectorsurvcollectionid func() null.Val[string] + Vectorsurvpoolid func() null.Val[string] + Vectorsurvtrapdataid func() null.Val[string] + Updated func() time.Time + + r fsPoolR + f *Factory + + alreadyPersisted bool +} + +type fsPoolR struct { + Organization *fsPoolROrganizationR +} + +type fsPoolROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSPoolTemplate +func (o *FSPoolTemplate) Apply(ctx context.Context, mods ...FSPoolMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSPool +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSPoolSetter +// this does nothing with the relationship templates +func (o FSPoolTemplate) BuildSetter() *models.FSPoolSetter { + m := &models.FSPoolSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datesent != nil { + val := o.Datesent() + m.Datesent = omitnull.FromNull(val) + } + if o.Datetested != nil { + val := o.Datetested() + m.Datetested = omitnull.FromNull(val) + } + if o.Diseasepos != nil { + val := o.Diseasepos() + m.Diseasepos = omitnull.FromNull(val) + } + if o.Diseasetested != nil { + val := o.Diseasetested() + m.Diseasetested = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lab != nil { + val := o.Lab() + m.Lab = omitnull.FromNull(val) + } + if o.LabID != nil { + val := o.LabID() + m.LabID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Poolyear != nil { + val := o.Poolyear() + m.Poolyear = omitnull.FromNull(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.Survtech != nil { + val := o.Survtech() + m.Survtech = omitnull.FromNull(val) + } + if o.Testmethod != nil { + val := o.Testmethod() + m.Testmethod = omitnull.FromNull(val) + } + if o.Testtech != nil { + val := o.Testtech() + m.Testtech = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Vectorsurvcollectionid != nil { + val := o.Vectorsurvcollectionid() + m.Vectorsurvcollectionid = omitnull.FromNull(val) + } + if o.Vectorsurvpoolid != nil { + val := o.Vectorsurvpoolid() + m.Vectorsurvpoolid = omitnull.FromNull(val) + } + if o.Vectorsurvtrapdataid != nil { + val := o.Vectorsurvtrapdataid() + m.Vectorsurvtrapdataid = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSPoolSetter +// this does nothing with the relationship templates +func (o FSPoolTemplate) BuildManySetter(number int) []*models.FSPoolSetter { + m := make([]*models.FSPoolSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSPool +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPoolTemplate.Create +func (o FSPoolTemplate) Build() *models.FSPool { + m := &models.FSPool{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datesent != nil { + m.Datesent = o.Datesent() + } + if o.Datetested != nil { + m.Datetested = o.Datetested() + } + if o.Diseasepos != nil { + m.Diseasepos = o.Diseasepos() + } + if o.Diseasetested != nil { + m.Diseasetested = o.Diseasetested() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lab != nil { + m.Lab = o.Lab() + } + if o.LabID != nil { + m.LabID = o.LabID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Poolyear != nil { + m.Poolyear = o.Poolyear() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.Survtech != nil { + m.Survtech = o.Survtech() + } + if o.Testmethod != nil { + m.Testmethod = o.Testmethod() + } + if o.Testtech != nil { + m.Testtech = o.Testtech() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Vectorsurvcollectionid != nil { + m.Vectorsurvcollectionid = o.Vectorsurvcollectionid() + } + if o.Vectorsurvpoolid != nil { + m.Vectorsurvpoolid = o.Vectorsurvpoolid() + } + if o.Vectorsurvtrapdataid != nil { + m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSPoolSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPoolTemplate.CreateMany +func (o FSPoolTemplate) BuildMany(number int) models.FSPoolSlice { + m := make(models.FSPoolSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSPool(m *models.FSPoolSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSPool +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsPool and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPool, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSPool(opt) + + m, err := models.FSPools.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsPool and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPool { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsPool 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 *FSPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPool { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsPools and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPoolSlice, error) { + var err error + m := make(models.FSPoolSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsPools and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPoolSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsPools 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 FSPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPoolSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSPool has methods that act as mods for the FSPoolTemplate +var FSPoolMods fsPoolMods + +type fsPoolMods struct{} + +func (m fsPoolMods) RandomizeAllColumns(f *faker.Faker) FSPoolMod { + return FSPoolModSlice{ + FSPoolMods.RandomOrganizationID(f), + FSPoolMods.RandomComments(f), + FSPoolMods.RandomCreationdate(f), + FSPoolMods.RandomCreator(f), + FSPoolMods.RandomDatesent(f), + FSPoolMods.RandomDatetested(f), + FSPoolMods.RandomDiseasepos(f), + FSPoolMods.RandomDiseasetested(f), + FSPoolMods.RandomEditdate(f), + FSPoolMods.RandomEditor(f), + FSPoolMods.RandomGatewaysync(f), + FSPoolMods.RandomGlobalid(f), + FSPoolMods.RandomLab(f), + FSPoolMods.RandomLabID(f), + FSPoolMods.RandomObjectid(f), + FSPoolMods.RandomPoolyear(f), + FSPoolMods.RandomProcessed(f), + FSPoolMods.RandomSampleid(f), + FSPoolMods.RandomSurvtech(f), + FSPoolMods.RandomTestmethod(f), + FSPoolMods.RandomTesttech(f), + FSPoolMods.RandomTrapdataID(f), + FSPoolMods.RandomCreatedDate(f), + FSPoolMods.RandomCreatedUser(f), + FSPoolMods.RandomGeometryX(f), + FSPoolMods.RandomGeometryY(f), + FSPoolMods.RandomLastEditedDate(f), + FSPoolMods.RandomLastEditedUser(f), + FSPoolMods.RandomVectorsurvcollectionid(f), + FSPoolMods.RandomVectorsurvpoolid(f), + FSPoolMods.RandomVectorsurvtrapdataid(f), + FSPoolMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsPoolMods) OrganizationID(val null.Val[int32]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) OrganizationIDFunc(f func() null.Val[int32]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetOrganizationID() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Comments(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) CommentsFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetComments() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Comments = 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 fsPoolMods) RandomComments(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Creationdate(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) CreationdateFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetCreationdate() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creationdate = 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 fsPoolMods) RandomCreationdate(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Creator(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) CreatorFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetCreator() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creator = 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 fsPoolMods) RandomCreator(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Datesent(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datesent = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) DatesentFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datesent = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetDatesent() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datesent = 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 fsPoolMods) RandomDatesent(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Datetested(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datetested = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) DatetestedFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datetested = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetDatetested() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datetested = 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 fsPoolMods) RandomDatetested(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Diseasepos(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasepos = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) DiseaseposFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasepos = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetDiseasepos() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasepos = 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 fsPoolMods) RandomDiseasepos(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseaseposNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Diseasetested(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasetested = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) DiseasetestedFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasetested = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetDiseasetested() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasetested = 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 fsPoolMods) RandomDiseasetested(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseasetestedNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Editdate(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) EditdateFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetEditdate() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editdate = 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 fsPoolMods) RandomEditdate(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Editor(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) EditorFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetEditor() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editor = 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 fsPoolMods) RandomEditor(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Gatewaysync(val null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) GatewaysyncFunc(f func() null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetGatewaysync() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Gatewaysync = 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 fsPoolMods) RandomGatewaysync(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Globalid(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) GlobalidFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetGlobalid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Globalid = 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 fsPoolMods) RandomGlobalid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Lab(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Lab = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) LabFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Lab = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetLab() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Lab = 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 fsPoolMods) RandomLab(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) LabID(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LabID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) LabIDFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LabID = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetLabID() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LabID = 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 fsPoolMods) RandomLabID(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LabID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabIDNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LabID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Objectid(val int32) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) ObjectidFunc(f func() int32) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetObjectid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPoolMods) RandomObjectid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Poolyear(val null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Poolyear = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) PoolyearFunc(f func() null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Poolyear = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetPoolyear() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Poolyear = 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 fsPoolMods) RandomPoolyear(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Poolyear = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPoolyearNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Poolyear = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Processed(val null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) ProcessedFunc(f func() null.Val[int16]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetProcessed() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Processed = 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 fsPoolMods) RandomProcessed(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Sampleid(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) SampleidFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetSampleid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Sampleid = 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 fsPoolMods) RandomSampleid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Survtech(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Survtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) SurvtechFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Survtech = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetSurvtech() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Survtech = 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 fsPoolMods) RandomSurvtech(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSurvtechNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Testmethod(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testmethod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) TestmethodFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testmethod = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetTestmethod() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testmethod = 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 fsPoolMods) RandomTestmethod(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTestmethodNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Testtech(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) TesttechFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testtech = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetTesttech() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testtech = 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 fsPoolMods) RandomTesttech(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTesttechNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) TrapdataID(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) TrapdataIDFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetTrapdataID() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.TrapdataID = 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 fsPoolMods) RandomTrapdataID(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) CreatedDate(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) CreatedDateFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetCreatedDate() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedDate = 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 fsPoolMods) RandomCreatedDate(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) CreatedUser(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) CreatedUserFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetCreatedUser() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedUser = 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 fsPoolMods) RandomCreatedUser(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) GeometryX(val null.Val[float64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) GeometryXFunc(f func() null.Val[float64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetGeometryX() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryX = 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 fsPoolMods) RandomGeometryX(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) GeometryY(val null.Val[float64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) GeometryYFunc(f func() null.Val[float64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetGeometryY() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryY = 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 fsPoolMods) RandomGeometryY(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) LastEditedDate(val null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) LastEditedDateFunc(f func() null.Val[int64]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetLastEditedDate() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedDate = 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 fsPoolMods) RandomLastEditedDate(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) LastEditedUser(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) LastEditedUserFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetLastEditedUser() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedUser = 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 fsPoolMods) RandomLastEditedUser(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Vectorsurvcollectionid(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) VectorsurvcollectionidFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvcollectionid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetVectorsurvcollectionid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvcollectionid = 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 fsPoolMods) RandomVectorsurvcollectionid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvcollectionidNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Vectorsurvpoolid(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) VectorsurvpoolidFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvpoolid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetVectorsurvpoolid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvpoolid = 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 fsPoolMods) RandomVectorsurvpoolid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvpoolidNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Vectorsurvtrapdataid(val null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvtrapdataid = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetVectorsurvtrapdataid() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvtrapdataid = 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 fsPoolMods) RandomVectorsurvtrapdataid(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPoolMods) Updated(val time.Time) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsPoolMods) UpdatedFunc(f func() time.Time) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsPoolMods) UnsetUpdated() FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPoolMods) RandomUpdated(f *faker.Faker) FSPoolMod { + return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsPoolMods) WithParentsCascading() FSPoolMod { + return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { + if isDone, _ := fsPoolWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsPoolWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsPoolMods) WithOrganization(rel *OrganizationTemplate) FSPoolMod { + return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { + o.r.Organization = &fsPoolROrganizationR{ + o: rel, + } + }) +} + +func (m fsPoolMods) WithNewOrganization(mods ...OrganizationMod) FSPoolMod { + return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsPoolMods) WithExistingOrganization(em *models.Organization) FSPoolMod { + return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { + o.r.Organization = &fsPoolROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsPoolMods) WithoutOrganization() FSPoolMod { + return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_pooldetail.bob.go b/factory/fs_pooldetail.bob.go new file mode 100644 index 00000000..d9ce3c6f --- /dev/null +++ b/factory/fs_pooldetail.bob.go @@ -0,0 +1,1360 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSPooldetailMod interface { + Apply(context.Context, *FSPooldetailTemplate) +} + +type FSPooldetailModFunc func(context.Context, *FSPooldetailTemplate) + +func (f FSPooldetailModFunc) Apply(ctx context.Context, n *FSPooldetailTemplate) { + f(ctx, n) +} + +type FSPooldetailModSlice []FSPooldetailMod + +func (mods FSPooldetailModSlice) Apply(ctx context.Context, n *FSPooldetailTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Females func() null.Val[int16] + Globalid func() null.Val[string] + Objectid func() int32 + PoolID func() null.Val[string] + Species func() null.Val[string] + TrapdataID func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsPooldetailR + f *Factory + + alreadyPersisted bool +} + +type fsPooldetailR struct { + Organization *fsPooldetailROrganizationR +} + +type fsPooldetailROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSPooldetailTemplate +func (o *FSPooldetailTemplate) Apply(ctx context.Context, mods ...FSPooldetailMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSPooldetail +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSPooldetailSetter +// this does nothing with the relationship templates +func (o FSPooldetailTemplate) BuildSetter() *models.FSPooldetailSetter { + m := &models.FSPooldetailSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Females != nil { + val := o.Females() + m.Females = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.PoolID != nil { + val := o.PoolID() + m.PoolID = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSPooldetailSetter +// this does nothing with the relationship templates +func (o FSPooldetailTemplate) BuildManySetter(number int) []*models.FSPooldetailSetter { + m := make([]*models.FSPooldetailSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSPooldetail +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPooldetailTemplate.Create +func (o FSPooldetailTemplate) Build() *models.FSPooldetail { + m := &models.FSPooldetail{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Females != nil { + m.Females = o.Females() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.PoolID != nil { + m.PoolID = o.PoolID() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSPooldetailSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSPooldetailTemplate.CreateMany +func (o FSPooldetailTemplate) BuildMany(number int) models.FSPooldetailSlice { + m := make(models.FSPooldetailSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSPooldetail +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsPooldetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPooldetail, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSPooldetail(opt) + + m, err := models.FSPooldetails.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsPooldetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPooldetail { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsPooldetail 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 *FSPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPooldetail { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsPooldetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPooldetailSlice, error) { + var err error + m := make(models.FSPooldetailSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsPooldetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPooldetailSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsPooldetails 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 FSPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPooldetailSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSPooldetail has methods that act as mods for the FSPooldetailTemplate +var FSPooldetailMods fsPooldetailMods + +type fsPooldetailMods struct{} + +func (m fsPooldetailMods) RandomizeAllColumns(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModSlice{ + FSPooldetailMods.RandomOrganizationID(f), + FSPooldetailMods.RandomCreationdate(f), + FSPooldetailMods.RandomCreator(f), + FSPooldetailMods.RandomEditdate(f), + FSPooldetailMods.RandomEditor(f), + FSPooldetailMods.RandomFemales(f), + FSPooldetailMods.RandomGlobalid(f), + FSPooldetailMods.RandomObjectid(f), + FSPooldetailMods.RandomPoolID(f), + FSPooldetailMods.RandomSpecies(f), + FSPooldetailMods.RandomTrapdataID(f), + FSPooldetailMods.RandomCreatedDate(f), + FSPooldetailMods.RandomCreatedUser(f), + FSPooldetailMods.RandomGeometryX(f), + FSPooldetailMods.RandomGeometryY(f), + FSPooldetailMods.RandomLastEditedDate(f), + FSPooldetailMods.RandomLastEditedUser(f), + FSPooldetailMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsPooldetailMods) OrganizationID(val null.Val[int32]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetOrganizationID() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Creationdate(val null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) CreationdateFunc(f func() null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetCreationdate() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creationdate = 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 fsPooldetailMods) RandomCreationdate(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Creator(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) CreatorFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetCreator() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creator = 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 fsPooldetailMods) RandomCreator(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Editdate(val null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) EditdateFunc(f func() null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetEditdate() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editdate = 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 fsPooldetailMods) RandomEditdate(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Editor(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) EditorFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetEditor() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editor = 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 fsPooldetailMods) RandomEditor(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Females(val null.Val[int16]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Females = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) FemalesFunc(f func() null.Val[int16]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Females = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetFemales() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Females = 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 fsPooldetailMods) RandomFemales(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Females = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFemalesNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Females = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Globalid(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) GlobalidFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetGlobalid() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Globalid = 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 fsPooldetailMods) RandomGlobalid(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Objectid(val int32) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) ObjectidFunc(f func() int32) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetObjectid() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPooldetailMods) RandomObjectid(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) PoolID(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.PoolID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) PoolIDFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.PoolID = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetPoolID() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.PoolID = 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 fsPooldetailMods) RandomPoolID(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.PoolID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPoolIDNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.PoolID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Species(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) SpeciesFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetSpecies() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Species = 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 fsPooldetailMods) RandomSpecies(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) TrapdataID(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) TrapdataIDFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetTrapdataID() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.TrapdataID = 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 fsPooldetailMods) RandomTrapdataID(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) CreatedDate(val null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) CreatedDateFunc(f func() null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetCreatedDate() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedDate = 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 fsPooldetailMods) RandomCreatedDate(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) CreatedUser(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) CreatedUserFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetCreatedUser() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedUser = 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 fsPooldetailMods) RandomCreatedUser(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) GeometryX(val null.Val[float64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) GeometryXFunc(f func() null.Val[float64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetGeometryX() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryX = 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 fsPooldetailMods) RandomGeometryX(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) GeometryY(val null.Val[float64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) GeometryYFunc(f func() null.Val[float64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetGeometryY() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryY = 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 fsPooldetailMods) RandomGeometryY(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) LastEditedDate(val null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) LastEditedDateFunc(f func() null.Val[int64]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetLastEditedDate() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedDate = 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 fsPooldetailMods) RandomLastEditedDate(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) LastEditedUser(val null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetLastEditedUser() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedUser = 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 fsPooldetailMods) RandomLastEditedUser(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsPooldetailMods) Updated(val time.Time) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsPooldetailMods) UpdatedFunc(f func() time.Time) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsPooldetailMods) UnsetUpdated() FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsPooldetailMods) RandomUpdated(f *faker.Faker) FSPooldetailMod { + return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsPooldetailMods) WithParentsCascading() FSPooldetailMod { + return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { + if isDone, _ := fsPooldetailWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsPooldetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsPooldetailMods) WithOrganization(rel *OrganizationTemplate) FSPooldetailMod { + return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { + o.r.Organization = &fsPooldetailROrganizationR{ + o: rel, + } + }) +} + +func (m fsPooldetailMods) WithNewOrganization(mods ...OrganizationMod) FSPooldetailMod { + return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsPooldetailMods) WithExistingOrganization(em *models.Organization) FSPooldetailMod { + return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { + o.r.Organization = &fsPooldetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsPooldetailMods) WithoutOrganization() FSPooldetailMod { + return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_proposedtreatmentarea.bob.go b/factory/fs_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..fda9e1ec --- /dev/null +++ b/factory/fs_proposedtreatmentarea.bob.go @@ -0,0 +1,2538 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSProposedtreatmentareaMod interface { + Apply(context.Context, *FSProposedtreatmentareaTemplate) +} + +type FSProposedtreatmentareaModFunc func(context.Context, *FSProposedtreatmentareaTemplate) + +func (f FSProposedtreatmentareaModFunc) Apply(ctx context.Context, n *FSProposedtreatmentareaTemplate) { + f(ctx, n) +} + +type FSProposedtreatmentareaModSlice []FSProposedtreatmentareaMod + +func (mods FSProposedtreatmentareaModSlice) Apply(ctx context.Context, n *FSProposedtreatmentareaTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Acres func() null.Val[float64] + Comments func() null.Val[string] + Completed func() null.Val[int16] + Completedby func() null.Val[string] + Completeddate func() null.Val[int64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Duedate func() null.Val[int64] + Exported func() null.Val[int16] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Hectares func() null.Val[float64] + Issprayroute func() null.Val[int16] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Method func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + Priority func() null.Val[string] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Targetapprate func() null.Val[float64] + Targetproduct func() null.Val[string] + Targetspecies func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Updated func() time.Time + + r fsProposedtreatmentareaR + f *Factory + + alreadyPersisted bool +} + +type fsProposedtreatmentareaR struct { + Organization *fsProposedtreatmentareaROrganizationR +} + +type fsProposedtreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSProposedtreatmentareaTemplate +func (o *FSProposedtreatmentareaTemplate) Apply(ctx context.Context, mods ...FSProposedtreatmentareaMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSProposedtreatmentarea +// according to the relationships in the template. Nothing is inserted into the db +func (t FSProposedtreatmentareaTemplate) setModelRels(o *models.FSProposedtreatmentarea) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSProposedtreatmentareaSetter +// this does nothing with the relationship templates +func (o FSProposedtreatmentareaTemplate) BuildSetter() *models.FSProposedtreatmentareaSetter { + m := &models.FSProposedtreatmentareaSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Completed != nil { + val := o.Completed() + m.Completed = omitnull.FromNull(val) + } + if o.Completedby != nil { + val := o.Completedby() + m.Completedby = omitnull.FromNull(val) + } + if o.Completeddate != nil { + val := o.Completeddate() + m.Completeddate = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Duedate != nil { + val := o.Duedate() + m.Duedate = omitnull.FromNull(val) + } + if o.Exported != nil { + val := o.Exported() + m.Exported = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Issprayroute != nil { + val := o.Issprayroute() + m.Issprayroute = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Method != nil { + val := o.Method() + m.Method = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Targetapprate != nil { + val := o.Targetapprate() + m.Targetapprate = omitnull.FromNull(val) + } + if o.Targetproduct != nil { + val := o.Targetproduct() + m.Targetproduct = omitnull.FromNull(val) + } + if o.Targetspecies != nil { + val := o.Targetspecies() + m.Targetspecies = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSProposedtreatmentareaSetter +// this does nothing with the relationship templates +func (o FSProposedtreatmentareaTemplate) BuildManySetter(number int) []*models.FSProposedtreatmentareaSetter { + m := make([]*models.FSProposedtreatmentareaSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSProposedtreatmentarea +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSProposedtreatmentareaTemplate.Create +func (o FSProposedtreatmentareaTemplate) Build() *models.FSProposedtreatmentarea { + m := &models.FSProposedtreatmentarea{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Completed != nil { + m.Completed = o.Completed() + } + if o.Completedby != nil { + m.Completedby = o.Completedby() + } + if o.Completeddate != nil { + m.Completeddate = o.Completeddate() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Duedate != nil { + m.Duedate = o.Duedate() + } + if o.Exported != nil { + m.Exported = o.Exported() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Issprayroute != nil { + m.Issprayroute = o.Issprayroute() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Method != nil { + m.Method = o.Method() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Targetapprate != nil { + m.Targetapprate = o.Targetapprate() + } + if o.Targetproduct != nil { + m.Targetproduct = o.Targetproduct() + } + if o.Targetspecies != nil { + m.Targetspecies = o.Targetspecies() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSProposedtreatmentareaSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSProposedtreatmentareaTemplate.CreateMany +func (o FSProposedtreatmentareaTemplate) BuildMany(number int) models.FSProposedtreatmentareaSlice { + m := make(models.FSProposedtreatmentareaSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSProposedtreatmentarea +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsProposedtreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSProposedtreatmentarea, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSProposedtreatmentarea(opt) + + m, err := models.FSProposedtreatmentareas.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsProposedtreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSProposedtreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSProposedtreatmentarea { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsProposedtreatmentarea 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 *FSProposedtreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSProposedtreatmentarea { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsProposedtreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSProposedtreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSProposedtreatmentareaSlice, error) { + var err error + m := make(models.FSProposedtreatmentareaSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsProposedtreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSProposedtreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSProposedtreatmentareaSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsProposedtreatmentareas 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 FSProposedtreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSProposedtreatmentareaSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSProposedtreatmentarea has methods that act as mods for the FSProposedtreatmentareaTemplate +var FSProposedtreatmentareaMods fsProposedtreatmentareaMods + +type fsProposedtreatmentareaMods struct{} + +func (m fsProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModSlice{ + FSProposedtreatmentareaMods.RandomOrganizationID(f), + FSProposedtreatmentareaMods.RandomAcres(f), + FSProposedtreatmentareaMods.RandomComments(f), + FSProposedtreatmentareaMods.RandomCompleted(f), + FSProposedtreatmentareaMods.RandomCompletedby(f), + FSProposedtreatmentareaMods.RandomCompleteddate(f), + FSProposedtreatmentareaMods.RandomCreationdate(f), + FSProposedtreatmentareaMods.RandomCreator(f), + FSProposedtreatmentareaMods.RandomDuedate(f), + FSProposedtreatmentareaMods.RandomExported(f), + FSProposedtreatmentareaMods.RandomEditdate(f), + FSProposedtreatmentareaMods.RandomEditor(f), + FSProposedtreatmentareaMods.RandomGlobalid(f), + FSProposedtreatmentareaMods.RandomHectares(f), + FSProposedtreatmentareaMods.RandomIssprayroute(f), + FSProposedtreatmentareaMods.RandomLasttreatactivity(f), + FSProposedtreatmentareaMods.RandomLasttreatdate(f), + FSProposedtreatmentareaMods.RandomLasttreatproduct(f), + FSProposedtreatmentareaMods.RandomLasttreatqty(f), + FSProposedtreatmentareaMods.RandomLasttreatqtyunit(f), + FSProposedtreatmentareaMods.RandomMethod(f), + FSProposedtreatmentareaMods.RandomName(f), + FSProposedtreatmentareaMods.RandomObjectid(f), + FSProposedtreatmentareaMods.RandomPriority(f), + FSProposedtreatmentareaMods.RandomReviewed(f), + FSProposedtreatmentareaMods.RandomReviewedby(f), + FSProposedtreatmentareaMods.RandomRevieweddate(f), + FSProposedtreatmentareaMods.RandomShapeArea(f), + FSProposedtreatmentareaMods.RandomShapeLength(f), + FSProposedtreatmentareaMods.RandomTargetapprate(f), + FSProposedtreatmentareaMods.RandomTargetproduct(f), + FSProposedtreatmentareaMods.RandomTargetspecies(f), + FSProposedtreatmentareaMods.RandomZone(f), + FSProposedtreatmentareaMods.RandomZone2(f), + FSProposedtreatmentareaMods.RandomGeometryX(f), + FSProposedtreatmentareaMods.RandomGeometryY(f), + FSProposedtreatmentareaMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) OrganizationID(val null.Val[int32]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetOrganizationID() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Acres(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) AcresFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetAcres() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Acres = 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 fsProposedtreatmentareaMods) RandomAcres(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Comments(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CommentsFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetComments() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Comments = 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 fsProposedtreatmentareaMods) RandomComments(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Completed(val null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completed = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetCompleted() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completed = 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 fsProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCompletedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Completedby(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CompletedbyFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completedby = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetCompletedby() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completedby = 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 fsProposedtreatmentareaMods) RandomCompletedby(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCompletedbyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Completeddate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CompleteddateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completeddate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetCompleteddate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completeddate = 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 fsProposedtreatmentareaMods) RandomCompleteddate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCompleteddateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Creationdate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetCreationdate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creationdate = 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 fsProposedtreatmentareaMods) RandomCreationdate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Creator(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) CreatorFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetCreator() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creator = 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 fsProposedtreatmentareaMods) RandomCreator(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Duedate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) DuedateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Duedate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetDuedate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Duedate = 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 fsProposedtreatmentareaMods) RandomDuedate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Exported(val null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Exported = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetExported() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Exported = 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 fsProposedtreatmentareaMods) RandomExported(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomExportedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Editdate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) EditdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetEditdate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editdate = 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 fsProposedtreatmentareaMods) RandomEditdate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Editor(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) EditorFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetEditor() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editor = 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 fsProposedtreatmentareaMods) RandomEditor(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Globalid(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) GlobalidFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetGlobalid() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Globalid = 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 fsProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Hectares(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) HectaresFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetHectares() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Hectares = 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 fsProposedtreatmentareaMods) RandomHectares(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Issprayroute = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetIssprayroute() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Issprayroute = 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 fsProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomIssprayrouteNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Lasttreatactivity(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) LasttreatactivityFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetLasttreatactivity() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatactivity = 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 fsProposedtreatmentareaMods) RandomLasttreatactivity(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Lasttreatdate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) LasttreatdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetLasttreatdate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatdate = 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 fsProposedtreatmentareaMods) RandomLasttreatdate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Lasttreatproduct(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) LasttreatproductFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetLasttreatproduct() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatproduct = 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 fsProposedtreatmentareaMods) RandomLasttreatproduct(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Lasttreatqty(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) LasttreatqtyFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetLasttreatqty() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqty = 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 fsProposedtreatmentareaMods) RandomLasttreatqty(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Lasttreatqtyunit(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetLasttreatqtyunit() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = 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 fsProposedtreatmentareaMods) RandomLasttreatqtyunit(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Method(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Method = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetMethod() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Method = 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 fsProposedtreatmentareaMods) RandomMethod(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMethodNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Name(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) NameFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetName() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Name = 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 fsProposedtreatmentareaMods) RandomName(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Objectid(val int32) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ObjectidFunc(f func() int32) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetObjectid() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Priority(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetPriority() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Priority = 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 fsProposedtreatmentareaMods) RandomPriority(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Reviewed(val null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetReviewed() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewed = 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 fsProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Reviewedby(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ReviewedbyFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetReviewedby() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewedby = 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 fsProposedtreatmentareaMods) RandomReviewedby(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Revieweddate(val null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) RevieweddateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetRevieweddate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Revieweddate = 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 fsProposedtreatmentareaMods) RandomRevieweddate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) ShapeArea(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetShapeArea() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeArea = 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 fsProposedtreatmentareaMods) RandomShapeArea(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) ShapeLength(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetShapeLength() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeLength = 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 fsProposedtreatmentareaMods) RandomShapeLength(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Targetapprate(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) TargetapprateFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetapprate = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetTargetapprate() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetapprate = 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 fsProposedtreatmentareaMods) RandomTargetapprate(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTargetapprateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Targetproduct(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) TargetproductFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetproduct = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetTargetproduct() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetproduct = 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 fsProposedtreatmentareaMods) RandomTargetproduct(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetproductNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Targetspecies(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) TargetspeciesFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetspecies = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetTargetspecies() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetspecies = 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 fsProposedtreatmentareaMods) RandomTargetspecies(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetspeciesNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Zone(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) ZoneFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetZone() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone = 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 fsProposedtreatmentareaMods) RandomZone(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Zone2(val null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) Zone2Func(f func() null.Val[string]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetZone2() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone2 = 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 fsProposedtreatmentareaMods) RandomZone2(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) GeometryX(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetGeometryX() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryX = 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 fsProposedtreatmentareaMods) RandomGeometryX(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) GeometryY(val null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetGeometryY() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryY = 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 fsProposedtreatmentareaMods) RandomGeometryY(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsProposedtreatmentareaMods) Updated(val time.Time) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsProposedtreatmentareaMods) UpdatedFunc(f func() time.Time) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsProposedtreatmentareaMods) UnsetUpdated() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsProposedtreatmentareaMods) RandomUpdated(f *faker.Faker) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsProposedtreatmentareaMods) WithParentsCascading() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { + if isDone, _ := fsProposedtreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsProposedtreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsProposedtreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { + o.r.Organization = &fsProposedtreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m fsProposedtreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsProposedtreatmentareaMods) WithExistingOrganization(em *models.Organization) FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { + o.r.Organization = &fsProposedtreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsProposedtreatmentareaMods) WithoutOrganization() FSProposedtreatmentareaMod { + return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_qamosquitoinspection.bob.go b/factory/fs_qamosquitoinspection.bob.go new file mode 100644 index 00000000..cdb8d67d --- /dev/null +++ b/factory/fs_qamosquitoinspection.bob.go @@ -0,0 +1,4336 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSQamosquitoinspectionMod interface { + Apply(context.Context, *FSQamosquitoinspectionTemplate) +} + +type FSQamosquitoinspectionModFunc func(context.Context, *FSQamosquitoinspectionTemplate) + +func (f FSQamosquitoinspectionModFunc) Apply(ctx context.Context, n *FSQamosquitoinspectionTemplate) { + f(ctx, n) +} + +type FSQamosquitoinspectionModSlice []FSQamosquitoinspectionMod + +func (mods FSQamosquitoinspectionModSlice) Apply(ctx context.Context, n *FSQamosquitoinspectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Acresbreeding func() null.Val[float64] + Actiontaken func() null.Val[string] + Adultactivity func() null.Val[int16] + Aquaticorganisms func() null.Val[string] + Avetemp func() null.Val[float64] + Breedingpotential func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Fish func() null.Val[int16] + Globalid func() null.Val[string] + Habvalue1 func() null.Val[int16] + Habvalue1percent func() null.Val[int16] + Habvalue2 func() null.Val[int16] + Habvalue2percent func() null.Val[int16] + Larvaeinsidetreatedarea func() null.Val[int16] + Larvaeoutsidetreatedarea func() null.Val[int16] + Larvaepresent func() null.Val[int16] + Larvaereason func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + LR func() null.Val[int16] + Mosquitohabitat func() null.Val[string] + Movingwater func() null.Val[int16] + Negdips func() null.Val[int16] + Nowaterever func() null.Val[int16] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Posdips func() null.Val[int16] + Potential func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sitetype func() null.Val[string] + Soilconditions func() null.Val[string] + Sourcereduction func() null.Val[string] + Startdatetime func() null.Val[int64] + Totalacres func() null.Val[float64] + Vegetation func() null.Val[string] + Waterconditions func() null.Val[string] + Waterduration func() null.Val[string] + Watermovement1 func() null.Val[string] + Watermovement1percent func() null.Val[int16] + Watermovement2 func() null.Val[string] + Watermovement2percent func() null.Val[int16] + Waterpresent func() null.Val[int16] + Watersource func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsQamosquitoinspectionR + f *Factory + + alreadyPersisted bool +} + +type fsQamosquitoinspectionR struct { + Organization *fsQamosquitoinspectionROrganizationR +} + +type fsQamosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSQamosquitoinspectionTemplate +func (o *FSQamosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FSQamosquitoinspectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSQamosquitoinspection +// according to the relationships in the template. Nothing is inserted into the db +func (t FSQamosquitoinspectionTemplate) setModelRels(o *models.FSQamosquitoinspection) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSQamosquitoinspectionSetter +// this does nothing with the relationship templates +func (o FSQamosquitoinspectionTemplate) BuildSetter() *models.FSQamosquitoinspectionSetter { + m := &models.FSQamosquitoinspectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Acresbreeding != nil { + val := o.Acresbreeding() + m.Acresbreeding = omitnull.FromNull(val) + } + if o.Actiontaken != nil { + val := o.Actiontaken() + m.Actiontaken = omitnull.FromNull(val) + } + if o.Adultactivity != nil { + val := o.Adultactivity() + m.Adultactivity = omitnull.FromNull(val) + } + if o.Aquaticorganisms != nil { + val := o.Aquaticorganisms() + m.Aquaticorganisms = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Breedingpotential != nil { + val := o.Breedingpotential() + m.Breedingpotential = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Fish != nil { + val := o.Fish() + m.Fish = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habvalue1 != nil { + val := o.Habvalue1() + m.Habvalue1 = omitnull.FromNull(val) + } + if o.Habvalue1percent != nil { + val := o.Habvalue1percent() + m.Habvalue1percent = omitnull.FromNull(val) + } + if o.Habvalue2 != nil { + val := o.Habvalue2() + m.Habvalue2 = omitnull.FromNull(val) + } + if o.Habvalue2percent != nil { + val := o.Habvalue2percent() + m.Habvalue2percent = omitnull.FromNull(val) + } + if o.Larvaeinsidetreatedarea != nil { + val := o.Larvaeinsidetreatedarea() + m.Larvaeinsidetreatedarea = omitnull.FromNull(val) + } + if o.Larvaeoutsidetreatedarea != nil { + val := o.Larvaeoutsidetreatedarea() + m.Larvaeoutsidetreatedarea = omitnull.FromNull(val) + } + if o.Larvaepresent != nil { + val := o.Larvaepresent() + m.Larvaepresent = omitnull.FromNull(val) + } + if o.Larvaereason != nil { + val := o.Larvaereason() + m.Larvaereason = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LR != nil { + val := o.LR() + m.LR = omitnull.FromNull(val) + } + if o.Mosquitohabitat != nil { + val := o.Mosquitohabitat() + m.Mosquitohabitat = omitnull.FromNull(val) + } + if o.Movingwater != nil { + val := o.Movingwater() + m.Movingwater = omitnull.FromNull(val) + } + if o.Negdips != nil { + val := o.Negdips() + m.Negdips = omitnull.FromNull(val) + } + if o.Nowaterever != nil { + val := o.Nowaterever() + m.Nowaterever = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Posdips != nil { + val := o.Posdips() + m.Posdips = omitnull.FromNull(val) + } + if o.Potential != nil { + val := o.Potential() + m.Potential = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sitetype != nil { + val := o.Sitetype() + m.Sitetype = omitnull.FromNull(val) + } + if o.Soilconditions != nil { + val := o.Soilconditions() + m.Soilconditions = omitnull.FromNull(val) + } + if o.Sourcereduction != nil { + val := o.Sourcereduction() + m.Sourcereduction = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Totalacres != nil { + val := o.Totalacres() + m.Totalacres = omitnull.FromNull(val) + } + if o.Vegetation != nil { + val := o.Vegetation() + m.Vegetation = omitnull.FromNull(val) + } + if o.Waterconditions != nil { + val := o.Waterconditions() + m.Waterconditions = omitnull.FromNull(val) + } + if o.Waterduration != nil { + val := o.Waterduration() + m.Waterduration = omitnull.FromNull(val) + } + if o.Watermovement1 != nil { + val := o.Watermovement1() + m.Watermovement1 = omitnull.FromNull(val) + } + if o.Watermovement1percent != nil { + val := o.Watermovement1percent() + m.Watermovement1percent = omitnull.FromNull(val) + } + if o.Watermovement2 != nil { + val := o.Watermovement2() + m.Watermovement2 = omitnull.FromNull(val) + } + if o.Watermovement2percent != nil { + val := o.Watermovement2percent() + m.Watermovement2percent = omitnull.FromNull(val) + } + if o.Waterpresent != nil { + val := o.Waterpresent() + m.Waterpresent = omitnull.FromNull(val) + } + if o.Watersource != nil { + val := o.Watersource() + m.Watersource = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSQamosquitoinspectionSetter +// this does nothing with the relationship templates +func (o FSQamosquitoinspectionTemplate) BuildManySetter(number int) []*models.FSQamosquitoinspectionSetter { + m := make([]*models.FSQamosquitoinspectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSQamosquitoinspection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSQamosquitoinspectionTemplate.Create +func (o FSQamosquitoinspectionTemplate) Build() *models.FSQamosquitoinspection { + m := &models.FSQamosquitoinspection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Acresbreeding != nil { + m.Acresbreeding = o.Acresbreeding() + } + if o.Actiontaken != nil { + m.Actiontaken = o.Actiontaken() + } + if o.Adultactivity != nil { + m.Adultactivity = o.Adultactivity() + } + if o.Aquaticorganisms != nil { + m.Aquaticorganisms = o.Aquaticorganisms() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Breedingpotential != nil { + m.Breedingpotential = o.Breedingpotential() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Fish != nil { + m.Fish = o.Fish() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habvalue1 != nil { + m.Habvalue1 = o.Habvalue1() + } + if o.Habvalue1percent != nil { + m.Habvalue1percent = o.Habvalue1percent() + } + if o.Habvalue2 != nil { + m.Habvalue2 = o.Habvalue2() + } + if o.Habvalue2percent != nil { + m.Habvalue2percent = o.Habvalue2percent() + } + if o.Larvaeinsidetreatedarea != nil { + m.Larvaeinsidetreatedarea = o.Larvaeinsidetreatedarea() + } + if o.Larvaeoutsidetreatedarea != nil { + m.Larvaeoutsidetreatedarea = o.Larvaeoutsidetreatedarea() + } + if o.Larvaepresent != nil { + m.Larvaepresent = o.Larvaepresent() + } + if o.Larvaereason != nil { + m.Larvaereason = o.Larvaereason() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LR != nil { + m.LR = o.LR() + } + if o.Mosquitohabitat != nil { + m.Mosquitohabitat = o.Mosquitohabitat() + } + if o.Movingwater != nil { + m.Movingwater = o.Movingwater() + } + if o.Negdips != nil { + m.Negdips = o.Negdips() + } + if o.Nowaterever != nil { + m.Nowaterever = o.Nowaterever() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Posdips != nil { + m.Posdips = o.Posdips() + } + if o.Potential != nil { + m.Potential = o.Potential() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sitetype != nil { + m.Sitetype = o.Sitetype() + } + if o.Soilconditions != nil { + m.Soilconditions = o.Soilconditions() + } + if o.Sourcereduction != nil { + m.Sourcereduction = o.Sourcereduction() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Totalacres != nil { + m.Totalacres = o.Totalacres() + } + if o.Vegetation != nil { + m.Vegetation = o.Vegetation() + } + if o.Waterconditions != nil { + m.Waterconditions = o.Waterconditions() + } + if o.Waterduration != nil { + m.Waterduration = o.Waterduration() + } + if o.Watermovement1 != nil { + m.Watermovement1 = o.Watermovement1() + } + if o.Watermovement1percent != nil { + m.Watermovement1percent = o.Watermovement1percent() + } + if o.Watermovement2 != nil { + m.Watermovement2 = o.Watermovement2() + } + if o.Watermovement2percent != nil { + m.Watermovement2percent = o.Watermovement2percent() + } + if o.Waterpresent != nil { + m.Waterpresent = o.Waterpresent() + } + if o.Watersource != nil { + m.Watersource = o.Watersource() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSQamosquitoinspectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSQamosquitoinspectionTemplate.CreateMany +func (o FSQamosquitoinspectionTemplate) BuildMany(number int) models.FSQamosquitoinspectionSlice { + m := make(models.FSQamosquitoinspectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSQamosquitoinspection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsQamosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSQamosquitoinspection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSQamosquitoinspection(opt) + + m, err := models.FSQamosquitoinspections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsQamosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSQamosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSQamosquitoinspection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsQamosquitoinspection 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 *FSQamosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSQamosquitoinspection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsQamosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSQamosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSQamosquitoinspectionSlice, error) { + var err error + m := make(models.FSQamosquitoinspectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsQamosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSQamosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSQamosquitoinspectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsQamosquitoinspections 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 FSQamosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSQamosquitoinspectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSQamosquitoinspection has methods that act as mods for the FSQamosquitoinspectionTemplate +var FSQamosquitoinspectionMods fsQamosquitoinspectionMods + +type fsQamosquitoinspectionMods struct{} + +func (m fsQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModSlice{ + FSQamosquitoinspectionMods.RandomOrganizationID(f), + FSQamosquitoinspectionMods.RandomAcresbreeding(f), + FSQamosquitoinspectionMods.RandomActiontaken(f), + FSQamosquitoinspectionMods.RandomAdultactivity(f), + FSQamosquitoinspectionMods.RandomAquaticorganisms(f), + FSQamosquitoinspectionMods.RandomAvetemp(f), + FSQamosquitoinspectionMods.RandomBreedingpotential(f), + FSQamosquitoinspectionMods.RandomComments(f), + FSQamosquitoinspectionMods.RandomCreationdate(f), + FSQamosquitoinspectionMods.RandomCreator(f), + FSQamosquitoinspectionMods.RandomEnddatetime(f), + FSQamosquitoinspectionMods.RandomEditdate(f), + FSQamosquitoinspectionMods.RandomEditor(f), + FSQamosquitoinspectionMods.RandomFieldtech(f), + FSQamosquitoinspectionMods.RandomFish(f), + FSQamosquitoinspectionMods.RandomGlobalid(f), + FSQamosquitoinspectionMods.RandomHabvalue1(f), + FSQamosquitoinspectionMods.RandomHabvalue1percent(f), + FSQamosquitoinspectionMods.RandomHabvalue2(f), + FSQamosquitoinspectionMods.RandomHabvalue2percent(f), + FSQamosquitoinspectionMods.RandomLarvaeinsidetreatedarea(f), + FSQamosquitoinspectionMods.RandomLarvaeoutsidetreatedarea(f), + FSQamosquitoinspectionMods.RandomLarvaepresent(f), + FSQamosquitoinspectionMods.RandomLarvaereason(f), + FSQamosquitoinspectionMods.RandomLinelocid(f), + FSQamosquitoinspectionMods.RandomLocationname(f), + FSQamosquitoinspectionMods.RandomLR(f), + FSQamosquitoinspectionMods.RandomMosquitohabitat(f), + FSQamosquitoinspectionMods.RandomMovingwater(f), + FSQamosquitoinspectionMods.RandomNegdips(f), + FSQamosquitoinspectionMods.RandomNowaterever(f), + FSQamosquitoinspectionMods.RandomObjectid(f), + FSQamosquitoinspectionMods.RandomPointlocid(f), + FSQamosquitoinspectionMods.RandomPolygonlocid(f), + FSQamosquitoinspectionMods.RandomPosdips(f), + FSQamosquitoinspectionMods.RandomPotential(f), + FSQamosquitoinspectionMods.RandomRaingauge(f), + FSQamosquitoinspectionMods.RandomRecordstatus(f), + FSQamosquitoinspectionMods.RandomReviewed(f), + FSQamosquitoinspectionMods.RandomReviewedby(f), + FSQamosquitoinspectionMods.RandomRevieweddate(f), + FSQamosquitoinspectionMods.RandomSitetype(f), + FSQamosquitoinspectionMods.RandomSoilconditions(f), + FSQamosquitoinspectionMods.RandomSourcereduction(f), + FSQamosquitoinspectionMods.RandomStartdatetime(f), + FSQamosquitoinspectionMods.RandomTotalacres(f), + FSQamosquitoinspectionMods.RandomVegetation(f), + FSQamosquitoinspectionMods.RandomWaterconditions(f), + FSQamosquitoinspectionMods.RandomWaterduration(f), + FSQamosquitoinspectionMods.RandomWatermovement1(f), + FSQamosquitoinspectionMods.RandomWatermovement1percent(f), + FSQamosquitoinspectionMods.RandomWatermovement2(f), + FSQamosquitoinspectionMods.RandomWatermovement2percent(f), + FSQamosquitoinspectionMods.RandomWaterpresent(f), + FSQamosquitoinspectionMods.RandomWatersource(f), + FSQamosquitoinspectionMods.RandomWinddir(f), + FSQamosquitoinspectionMods.RandomWindspeed(f), + FSQamosquitoinspectionMods.RandomZone(f), + FSQamosquitoinspectionMods.RandomZone2(f), + FSQamosquitoinspectionMods.RandomCreatedDate(f), + FSQamosquitoinspectionMods.RandomCreatedUser(f), + FSQamosquitoinspectionMods.RandomGeometryX(f), + FSQamosquitoinspectionMods.RandomGeometryY(f), + FSQamosquitoinspectionMods.RandomLastEditedDate(f), + FSQamosquitoinspectionMods.RandomLastEditedUser(f), + FSQamosquitoinspectionMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetOrganizationID() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Acresbreeding(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) AcresbreedingFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Acresbreeding = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetAcresbreeding() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Acresbreeding = 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 fsQamosquitoinspectionMods) RandomAcresbreeding(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresbreedingNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Actiontaken(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Actiontaken = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetActiontaken() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Actiontaken = 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 fsQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActiontakenNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Adultactivity = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetAdultactivity() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Adultactivity = 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 fsQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomAdultactivityNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Aquaticorganisms = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetAquaticorganisms() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Aquaticorganisms = 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 fsQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAquaticorganismsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Avetemp(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetAvetemp() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Avetemp = 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 fsQamosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Breedingpotential = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetBreedingpotential() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Breedingpotential = 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 fsQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBreedingpotentialNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Comments(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetComments() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Comments = 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 fsQamosquitoinspectionMods) RandomComments(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Creationdate(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetCreationdate() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creationdate = 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 fsQamosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Creator(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetCreator() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creator = 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 fsQamosquitoinspectionMods) RandomCreator(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Enddatetime(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetEnddatetime() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Enddatetime = 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 fsQamosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Editdate(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetEditdate() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editdate = 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 fsQamosquitoinspectionMods) RandomEditdate(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Editor(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetEditor() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editor = 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 fsQamosquitoinspectionMods) RandomEditor(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Fieldtech(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetFieldtech() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fieldtech = 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 fsQamosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Fish(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fish = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetFish() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fish = 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 fsQamosquitoinspectionMods) RandomFish(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFishNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Globalid(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetGlobalid() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Globalid = 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 fsQamosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Habvalue1(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Habvalue1Func(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1 = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetHabvalue1() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1 = 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 fsQamosquitoinspectionMods) RandomHabvalue1(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue1NotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Habvalue1percent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Habvalue1percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1percent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetHabvalue1percent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1percent = 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 fsQamosquitoinspectionMods) RandomHabvalue1percent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue1percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Habvalue2(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Habvalue2Func(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2 = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetHabvalue2() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2 = 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 fsQamosquitoinspectionMods) RandomHabvalue2(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Habvalue2percent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Habvalue2percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2percent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetHabvalue2percent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2percent = 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 fsQamosquitoinspectionMods) RandomHabvalue2percent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue2percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = 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 fsQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = 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 fsQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaepresent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLarvaepresent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaepresent = 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 fsQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Larvaereason(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaereason = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLarvaereason() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaereason = 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 fsQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLarvaereasonNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Linelocid(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLinelocid() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Linelocid = 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 fsQamosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Locationname(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLocationname() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Locationname = 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 fsQamosquitoinspectionMods) RandomLocationname(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) LR(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LRFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LR = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLR() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LR = 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 fsQamosquitoinspectionMods) RandomLR(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLRNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Mosquitohabitat = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetMosquitohabitat() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Mosquitohabitat = 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 fsQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMosquitohabitatNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Movingwater(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Movingwater = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetMovingwater() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Movingwater = 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 fsQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomMovingwaterNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Negdips(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) NegdipsFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Negdips = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetNegdips() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Negdips = 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 fsQamosquitoinspectionMods) RandomNegdips(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNegdipsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Nowaterever = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetNowaterever() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Nowaterever = 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 fsQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNowatereverNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Objectid(val int32) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) ObjectidFunc(f func() int32) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetObjectid() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsQamosquitoinspectionMods) RandomObjectid(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Pointlocid(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetPointlocid() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Pointlocid = 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 fsQamosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Polygonlocid(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetPolygonlocid() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Polygonlocid = 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 fsQamosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Posdips(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Posdips = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetPosdips() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Posdips = 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 fsQamosquitoinspectionMods) RandomPosdips(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Potential(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) PotentialFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Potential = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetPotential() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Potential = 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 fsQamosquitoinspectionMods) RandomPotential(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPotentialNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Raingauge(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetRaingauge() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Raingauge = 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 fsQamosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Recordstatus(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetRecordstatus() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Recordstatus = 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 fsQamosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Reviewed(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetReviewed() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewed = 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 fsQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Reviewedby(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetReviewedby() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewedby = 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 fsQamosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Revieweddate(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetRevieweddate() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Revieweddate = 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 fsQamosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Sitetype(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sitetype = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetSitetype() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sitetype = 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 fsQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitetypeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Soilconditions(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Soilconditions = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetSoilconditions() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Soilconditions = 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 fsQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSoilconditionsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sourcereduction = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetSourcereduction() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sourcereduction = 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 fsQamosquitoinspectionMods) RandomSourcereduction(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourcereductionNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Startdatetime(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetStartdatetime() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Startdatetime = 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 fsQamosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Totalacres(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) TotalacresFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Totalacres = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetTotalacres() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Totalacres = 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 fsQamosquitoinspectionMods) RandomTotalacres(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTotalacresNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Vegetation(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Vegetation = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetVegetation() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Vegetation = 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 fsQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVegetationNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Waterconditions(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterconditions = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWaterconditions() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterconditions = 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 fsQamosquitoinspectionMods) RandomWaterconditions(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWaterconditionsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Waterduration(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterduration = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWaterduration() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterduration = 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 fsQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWaterdurationNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Watermovement1(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1 = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWatermovement1() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1 = 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 fsQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatermovement1NotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Watermovement1percent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Watermovement1percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1percent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWatermovement1percent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1percent = 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 fsQamosquitoinspectionMods) RandomWatermovement1percent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWatermovement1percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Watermovement2(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2 = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWatermovement2() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2 = 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 fsQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatermovement2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Watermovement2percent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Watermovement2percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2percent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWatermovement2percent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2percent = 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 fsQamosquitoinspectionMods) RandomWatermovement2percent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWatermovement2percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterpresent = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWaterpresent() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterpresent = 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 fsQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWaterpresentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Watersource(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watersource = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWatersource() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watersource = 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 fsQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatersourceNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Winddir(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWinddir() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Winddir = 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 fsQamosquitoinspectionMods) RandomWinddir(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Windspeed(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetWindspeed() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Windspeed = 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 fsQamosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Zone(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetZone() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone = 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 fsQamosquitoinspectionMods) RandomZone(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Zone2(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetZone2() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone2 = 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 fsQamosquitoinspectionMods) RandomZone2(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) CreatedDate(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetCreatedDate() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedDate = 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 fsQamosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) CreatedUser(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetCreatedUser() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedUser = 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 fsQamosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) GeometryX(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetGeometryX() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryX = 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 fsQamosquitoinspectionMods) RandomGeometryX(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) GeometryY(val null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetGeometryY() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryY = 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 fsQamosquitoinspectionMods) RandomGeometryY(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) LastEditedDate(val null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLastEditedDate() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedDate = 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 fsQamosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) LastEditedUser(val null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetLastEditedUser() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedUser = 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 fsQamosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsQamosquitoinspectionMods) Updated(val time.Time) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsQamosquitoinspectionMods) UpdatedFunc(f func() time.Time) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsQamosquitoinspectionMods) UnsetUpdated() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsQamosquitoinspectionMods) RandomUpdated(f *faker.Faker) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsQamosquitoinspectionMods) WithParentsCascading() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { + if isDone, _ := fsQamosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsQamosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsQamosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { + o.r.Organization = &fsQamosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m fsQamosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsQamosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { + o.r.Organization = &fsQamosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsQamosquitoinspectionMods) WithoutOrganization() FSQamosquitoinspectionMod { + return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_rodentlocation.bob.go b/factory/fs_rodentlocation.bob.go new file mode 100644 index 00000000..6abe7057 --- /dev/null +++ b/factory/fs_rodentlocation.bob.go @@ -0,0 +1,2352 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSRodentlocationMod interface { + Apply(context.Context, *FSRodentlocationTemplate) +} + +type FSRodentlocationModFunc func(context.Context, *FSRodentlocationTemplate) + +func (f FSRodentlocationModFunc) Apply(ctx context.Context, n *FSRodentlocationTemplate) { + f(ctx, n) +} + +type FSRodentlocationModSlice []FSRodentlocationMod + +func (mods FSRodentlocationModSlice) Apply(ctx context.Context, n *FSRodentlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Lastinspectaction func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectrodentevidence func() null.Val[string] + Lastinspectspecies func() null.Val[string] + Locationname func() null.Val[string] + Locationnumber func() null.Val[int64] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Jurisdiction func() null.Val[string] + Updated func() time.Time + + r fsRodentlocationR + f *Factory + + alreadyPersisted bool +} + +type fsRodentlocationR struct { + Organization *fsRodentlocationROrganizationR +} + +type fsRodentlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSRodentlocationTemplate +func (o *FSRodentlocationTemplate) Apply(ctx context.Context, mods ...FSRodentlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSRodentlocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSRodentlocationSetter +// this does nothing with the relationship templates +func (o FSRodentlocationTemplate) BuildSetter() *models.FSRodentlocationSetter { + m := &models.FSRodentlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Lastinspectaction != nil { + val := o.Lastinspectaction() + m.Lastinspectaction = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectrodentevidence != nil { + val := o.Lastinspectrodentevidence() + m.Lastinspectrodentevidence = omitnull.FromNull(val) + } + if o.Lastinspectspecies != nil { + val := o.Lastinspectspecies() + m.Lastinspectspecies = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSRodentlocationSetter +// this does nothing with the relationship templates +func (o FSRodentlocationTemplate) BuildManySetter(number int) []*models.FSRodentlocationSetter { + m := make([]*models.FSRodentlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSRodentlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSRodentlocationTemplate.Create +func (o FSRodentlocationTemplate) Build() *models.FSRodentlocation { + m := &models.FSRodentlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Lastinspectaction != nil { + m.Lastinspectaction = o.Lastinspectaction() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectrodentevidence != nil { + m.Lastinspectrodentevidence = o.Lastinspectrodentevidence() + } + if o.Lastinspectspecies != nil { + m.Lastinspectspecies = o.Lastinspectspecies() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSRodentlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSRodentlocationTemplate.CreateMany +func (o FSRodentlocationTemplate) BuildMany(number int) models.FSRodentlocationSlice { + m := make(models.FSRodentlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSRodentlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsRodentlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSRodentlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSRodentlocation(opt) + + m, err := models.FSRodentlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsRodentlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSRodentlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSRodentlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsRodentlocation 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 *FSRodentlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSRodentlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsRodentlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSRodentlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSRodentlocationSlice, error) { + var err error + m := make(models.FSRodentlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsRodentlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSRodentlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSRodentlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsRodentlocations 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 FSRodentlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSRodentlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSRodentlocation has methods that act as mods for the FSRodentlocationTemplate +var FSRodentlocationMods fsRodentlocationMods + +type fsRodentlocationMods struct{} + +func (m fsRodentlocationMods) RandomizeAllColumns(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModSlice{ + FSRodentlocationMods.RandomOrganizationID(f), + FSRodentlocationMods.RandomAccessdesc(f), + FSRodentlocationMods.RandomActive(f), + FSRodentlocationMods.RandomComments(f), + FSRodentlocationMods.RandomCreationdate(f), + FSRodentlocationMods.RandomCreator(f), + FSRodentlocationMods.RandomDescription(f), + FSRodentlocationMods.RandomExternalid(f), + FSRodentlocationMods.RandomEditdate(f), + FSRodentlocationMods.RandomEditor(f), + FSRodentlocationMods.RandomGlobalid(f), + FSRodentlocationMods.RandomHabitat(f), + FSRodentlocationMods.RandomLastinspectaction(f), + FSRodentlocationMods.RandomLastinspectconditions(f), + FSRodentlocationMods.RandomLastinspectdate(f), + FSRodentlocationMods.RandomLastinspectrodentevidence(f), + FSRodentlocationMods.RandomLastinspectspecies(f), + FSRodentlocationMods.RandomLocationname(f), + FSRodentlocationMods.RandomLocationnumber(f), + FSRodentlocationMods.RandomNextactiondatescheduled(f), + FSRodentlocationMods.RandomObjectid(f), + FSRodentlocationMods.RandomPriority(f), + FSRodentlocationMods.RandomSymbology(f), + FSRodentlocationMods.RandomUsetype(f), + FSRodentlocationMods.RandomZone(f), + FSRodentlocationMods.RandomZone2(f), + FSRodentlocationMods.RandomCreatedDate(f), + FSRodentlocationMods.RandomCreatedUser(f), + FSRodentlocationMods.RandomGeometryX(f), + FSRodentlocationMods.RandomGeometryY(f), + FSRodentlocationMods.RandomLastEditedDate(f), + FSRodentlocationMods.RandomLastEditedUser(f), + FSRodentlocationMods.RandomJurisdiction(f), + FSRodentlocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsRodentlocationMods) OrganizationID(val null.Val[int32]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetOrganizationID() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Accessdesc(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) AccessdescFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetAccessdesc() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Accessdesc = 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 fsRodentlocationMods) RandomAccessdesc(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Active(val null.Val[int16]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) ActiveFunc(f func() null.Val[int16]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetActive() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Active = 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 fsRodentlocationMods) RandomActive(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Comments(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) CommentsFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetComments() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Comments = 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 fsRodentlocationMods) RandomComments(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Creationdate(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) CreationdateFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetCreationdate() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creationdate = 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 fsRodentlocationMods) RandomCreationdate(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Creator(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) CreatorFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetCreator() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creator = 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 fsRodentlocationMods) RandomCreator(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Description(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) DescriptionFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetDescription() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Description = 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 fsRodentlocationMods) RandomDescription(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Externalid(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) ExternalidFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetExternalid() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Externalid = 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 fsRodentlocationMods) RandomExternalid(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Editdate(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) EditdateFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetEditdate() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editdate = 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 fsRodentlocationMods) RandomEditdate(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Editor(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) EditorFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetEditor() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editor = 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 fsRodentlocationMods) RandomEditor(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Globalid(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) GlobalidFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetGlobalid() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Globalid = 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 fsRodentlocationMods) RandomGlobalid(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Habitat(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) HabitatFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetHabitat() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Habitat = 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 fsRodentlocationMods) RandomHabitat(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Lastinspectaction(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastinspectactionFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectaction = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastinspectaction() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectaction = 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 fsRodentlocationMods) RandomLastinspectaction(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactionNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Lastinspectconditions(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastinspectconditions() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectconditions = 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 fsRodentlocationMods) RandomLastinspectconditions(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Lastinspectdate(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastinspectdate() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectdate = 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 fsRodentlocationMods) RandomLastinspectdate(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Lastinspectrodentevidence(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastinspectrodentevidenceFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectrodentevidence = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastinspectrodentevidence() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectrodentevidence = 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 fsRodentlocationMods) RandomLastinspectrodentevidence(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectrodentevidenceNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Lastinspectspecies(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastinspectspeciesFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectspecies = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastinspectspecies() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectspecies = 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 fsRodentlocationMods) RandomLastinspectspecies(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectspeciesNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Locationname(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LocationnameFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLocationname() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationname = 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 fsRodentlocationMods) RandomLocationname(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Locationnumber(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLocationnumber() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationnumber = 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 fsRodentlocationMods) RandomLocationnumber(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetNextactiondatescheduled() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Nextactiondatescheduled = 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 fsRodentlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Objectid(val int32) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) ObjectidFunc(f func() int32) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetObjectid() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsRodentlocationMods) RandomObjectid(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Priority(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) PriorityFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetPriority() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Priority = 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 fsRodentlocationMods) RandomPriority(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Symbology(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) SymbologyFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetSymbology() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Symbology = 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 fsRodentlocationMods) RandomSymbology(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Usetype(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) UsetypeFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetUsetype() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Usetype = 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 fsRodentlocationMods) RandomUsetype(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Zone(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) ZoneFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetZone() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone = 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 fsRodentlocationMods) RandomZone(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Zone2(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) Zone2Func(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetZone2() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone2 = 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 fsRodentlocationMods) RandomZone2(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) CreatedDate(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) CreatedDateFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetCreatedDate() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedDate = 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 fsRodentlocationMods) RandomCreatedDate(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) CreatedUser(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) CreatedUserFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetCreatedUser() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedUser = 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 fsRodentlocationMods) RandomCreatedUser(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) GeometryX(val null.Val[float64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) GeometryXFunc(f func() null.Val[float64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetGeometryX() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryX = 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 fsRodentlocationMods) RandomGeometryX(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) GeometryY(val null.Val[float64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) GeometryYFunc(f func() null.Val[float64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetGeometryY() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryY = 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 fsRodentlocationMods) RandomGeometryY(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) LastEditedDate(val null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastEditedDate() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedDate = 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 fsRodentlocationMods) RandomLastEditedDate(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) LastEditedUser(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) LastEditedUserFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetLastEditedUser() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedUser = 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 fsRodentlocationMods) RandomLastEditedUser(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Jurisdiction(val null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) JurisdictionFunc(f func() null.Val[string]) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetJurisdiction() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Jurisdiction = 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 fsRodentlocationMods) RandomJurisdiction(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsRodentlocationMods) Updated(val time.Time) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsRodentlocationMods) UpdatedFunc(f func() time.Time) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsRodentlocationMods) UnsetUpdated() FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsRodentlocationMods) RandomUpdated(f *faker.Faker) FSRodentlocationMod { + return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsRodentlocationMods) WithParentsCascading() FSRodentlocationMod { + return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { + if isDone, _ := fsRodentlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsRodentlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsRodentlocationMods) WithOrganization(rel *OrganizationTemplate) FSRodentlocationMod { + return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { + o.r.Organization = &fsRodentlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsRodentlocationMods) WithNewOrganization(mods ...OrganizationMod) FSRodentlocationMod { + return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsRodentlocationMods) WithExistingOrganization(em *models.Organization) FSRodentlocationMod { + return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { + o.r.Organization = &fsRodentlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsRodentlocationMods) WithoutOrganization() FSRodentlocationMod { + return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_samplecollection.bob.go b/factory/fs_samplecollection.bob.go new file mode 100644 index 00000000..2b17a87e --- /dev/null +++ b/factory/fs_samplecollection.bob.go @@ -0,0 +1,3344 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSSamplecollectionMod interface { + Apply(context.Context, *FSSamplecollectionTemplate) +} + +type FSSamplecollectionModFunc func(context.Context, *FSSamplecollectionTemplate) + +func (f FSSamplecollectionModFunc) Apply(ctx context.Context, n *FSSamplecollectionTemplate) { + f(ctx, n) +} + +type FSSamplecollectionModSlice []FSSamplecollectionMod + +func (mods FSSamplecollectionModSlice) Apply(ctx context.Context, n *FSSamplecollectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Avetemp func() null.Val[float64] + Chickenid func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datesent func() null.Val[int64] + Datetested func() null.Val[int64] + Diseasepos func() null.Val[string] + Diseasetested func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Flockid func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Lab func() null.Val[string] + Locationname func() null.Val[string] + LocID func() null.Val[string] + Objectid func() int32 + Processed func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Samplecond func() null.Val[string] + Samplecount func() null.Val[int16] + Sampleid func() null.Val[string] + Sampletype func() null.Val[string] + Sex func() null.Val[string] + Sitecond func() null.Val[string] + Species func() null.Val[string] + Startdatetime func() null.Val[int64] + Survtech func() null.Val[string] + Testmethod func() null.Val[string] + Testtech func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsSamplecollectionR + f *Factory + + alreadyPersisted bool +} + +type fsSamplecollectionR struct { + Organization *fsSamplecollectionROrganizationR +} + +type fsSamplecollectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSSamplecollectionTemplate +func (o *FSSamplecollectionTemplate) Apply(ctx context.Context, mods ...FSSamplecollectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSSamplecollection +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSSamplecollectionSetter +// this does nothing with the relationship templates +func (o FSSamplecollectionTemplate) BuildSetter() *models.FSSamplecollectionSetter { + m := &models.FSSamplecollectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Chickenid != nil { + val := o.Chickenid() + m.Chickenid = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datesent != nil { + val := o.Datesent() + m.Datesent = omitnull.FromNull(val) + } + if o.Datetested != nil { + val := o.Datetested() + m.Datetested = omitnull.FromNull(val) + } + if o.Diseasepos != nil { + val := o.Diseasepos() + m.Diseasepos = omitnull.FromNull(val) + } + if o.Diseasetested != nil { + val := o.Diseasetested() + m.Diseasetested = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Flockid != nil { + val := o.Flockid() + m.Flockid = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lab != nil { + val := o.Lab() + m.Lab = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LocID != nil { + val := o.LocID() + m.LocID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Samplecond != nil { + val := o.Samplecond() + m.Samplecond = omitnull.FromNull(val) + } + if o.Samplecount != nil { + val := o.Samplecount() + m.Samplecount = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.Sampletype != nil { + val := o.Sampletype() + m.Sampletype = omitnull.FromNull(val) + } + if o.Sex != nil { + val := o.Sex() + m.Sex = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Survtech != nil { + val := o.Survtech() + m.Survtech = omitnull.FromNull(val) + } + if o.Testmethod != nil { + val := o.Testmethod() + m.Testmethod = omitnull.FromNull(val) + } + if o.Testtech != nil { + val := o.Testtech() + m.Testtech = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSSamplecollectionSetter +// this does nothing with the relationship templates +func (o FSSamplecollectionTemplate) BuildManySetter(number int) []*models.FSSamplecollectionSetter { + m := make([]*models.FSSamplecollectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSSamplecollection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSamplecollectionTemplate.Create +func (o FSSamplecollectionTemplate) Build() *models.FSSamplecollection { + m := &models.FSSamplecollection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Chickenid != nil { + m.Chickenid = o.Chickenid() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datesent != nil { + m.Datesent = o.Datesent() + } + if o.Datetested != nil { + m.Datetested = o.Datetested() + } + if o.Diseasepos != nil { + m.Diseasepos = o.Diseasepos() + } + if o.Diseasetested != nil { + m.Diseasetested = o.Diseasetested() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Flockid != nil { + m.Flockid = o.Flockid() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lab != nil { + m.Lab = o.Lab() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LocID != nil { + m.LocID = o.LocID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Samplecond != nil { + m.Samplecond = o.Samplecond() + } + if o.Samplecount != nil { + m.Samplecount = o.Samplecount() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.Sampletype != nil { + m.Sampletype = o.Sampletype() + } + if o.Sex != nil { + m.Sex = o.Sex() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Survtech != nil { + m.Survtech = o.Survtech() + } + if o.Testmethod != nil { + m.Testmethod = o.Testmethod() + } + if o.Testtech != nil { + m.Testtech = o.Testtech() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSSamplecollectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSamplecollectionTemplate.CreateMany +func (o FSSamplecollectionTemplate) BuildMany(number int) models.FSSamplecollectionSlice { + m := make(models.FSSamplecollectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSSamplecollection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsSamplecollection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSSamplecollectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSamplecollection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSSamplecollection(opt) + + m, err := models.FSSamplecollections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsSamplecollection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSSamplecollectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSamplecollection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsSamplecollection 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 *FSSamplecollectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSamplecollection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsSamplecollections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSSamplecollectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSamplecollectionSlice, error) { + var err error + m := make(models.FSSamplecollectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsSamplecollections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSSamplecollectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSamplecollectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsSamplecollections 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 FSSamplecollectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSamplecollectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSSamplecollection has methods that act as mods for the FSSamplecollectionTemplate +var FSSamplecollectionMods fsSamplecollectionMods + +type fsSamplecollectionMods struct{} + +func (m fsSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModSlice{ + FSSamplecollectionMods.RandomOrganizationID(f), + FSSamplecollectionMods.RandomActivity(f), + FSSamplecollectionMods.RandomAvetemp(f), + FSSamplecollectionMods.RandomChickenid(f), + FSSamplecollectionMods.RandomComments(f), + FSSamplecollectionMods.RandomCreationdate(f), + FSSamplecollectionMods.RandomCreator(f), + FSSamplecollectionMods.RandomDatesent(f), + FSSamplecollectionMods.RandomDatetested(f), + FSSamplecollectionMods.RandomDiseasepos(f), + FSSamplecollectionMods.RandomDiseasetested(f), + FSSamplecollectionMods.RandomEnddatetime(f), + FSSamplecollectionMods.RandomEditdate(f), + FSSamplecollectionMods.RandomEditor(f), + FSSamplecollectionMods.RandomFieldtech(f), + FSSamplecollectionMods.RandomFlockid(f), + FSSamplecollectionMods.RandomGatewaysync(f), + FSSamplecollectionMods.RandomGlobalid(f), + FSSamplecollectionMods.RandomLab(f), + FSSamplecollectionMods.RandomLocationname(f), + FSSamplecollectionMods.RandomLocID(f), + FSSamplecollectionMods.RandomObjectid(f), + FSSamplecollectionMods.RandomProcessed(f), + FSSamplecollectionMods.RandomRaingauge(f), + FSSamplecollectionMods.RandomRecordstatus(f), + FSSamplecollectionMods.RandomReviewed(f), + FSSamplecollectionMods.RandomReviewedby(f), + FSSamplecollectionMods.RandomRevieweddate(f), + FSSamplecollectionMods.RandomSamplecond(f), + FSSamplecollectionMods.RandomSamplecount(f), + FSSamplecollectionMods.RandomSampleid(f), + FSSamplecollectionMods.RandomSampletype(f), + FSSamplecollectionMods.RandomSex(f), + FSSamplecollectionMods.RandomSitecond(f), + FSSamplecollectionMods.RandomSpecies(f), + FSSamplecollectionMods.RandomStartdatetime(f), + FSSamplecollectionMods.RandomSurvtech(f), + FSSamplecollectionMods.RandomTestmethod(f), + FSSamplecollectionMods.RandomTesttech(f), + FSSamplecollectionMods.RandomWinddir(f), + FSSamplecollectionMods.RandomWindspeed(f), + FSSamplecollectionMods.RandomZone(f), + FSSamplecollectionMods.RandomZone2(f), + FSSamplecollectionMods.RandomCreatedDate(f), + FSSamplecollectionMods.RandomCreatedUser(f), + FSSamplecollectionMods.RandomGeometryX(f), + FSSamplecollectionMods.RandomGeometryY(f), + FSSamplecollectionMods.RandomLastEditedDate(f), + FSSamplecollectionMods.RandomLastEditedUser(f), + FSSamplecollectionMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) OrganizationID(val null.Val[int32]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetOrganizationID() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Activity(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ActivityFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetActivity() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Activity = 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 fsSamplecollectionMods) RandomActivity(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Avetemp(val null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) AvetempFunc(f func() null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetAvetemp() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Avetemp = 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 fsSamplecollectionMods) RandomAvetemp(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Chickenid(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ChickenidFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Chickenid = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetChickenid() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Chickenid = 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 fsSamplecollectionMods) RandomChickenid(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomChickenidNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Comments(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) CommentsFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetComments() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Comments = 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 fsSamplecollectionMods) RandomComments(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Creationdate(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) CreationdateFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetCreationdate() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creationdate = 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 fsSamplecollectionMods) RandomCreationdate(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Creator(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) CreatorFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetCreator() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creator = 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 fsSamplecollectionMods) RandomCreator(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Datesent(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) DatesentFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datesent = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetDatesent() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datesent = 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 fsSamplecollectionMods) RandomDatesent(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Datetested(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) DatetestedFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datetested = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetDatetested() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datetested = 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 fsSamplecollectionMods) RandomDatetested(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Diseasepos(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasepos = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetDiseasepos() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasepos = 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 fsSamplecollectionMods) RandomDiseasepos(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseaseposNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Diseasetested(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasetested = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetDiseasetested() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasetested = 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 fsSamplecollectionMods) RandomDiseasetested(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseasetestedNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Enddatetime(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetEnddatetime() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Enddatetime = 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 fsSamplecollectionMods) RandomEnddatetime(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Editdate(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) EditdateFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetEditdate() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editdate = 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 fsSamplecollectionMods) RandomEditdate(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Editor(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) EditorFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetEditor() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editor = 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 fsSamplecollectionMods) RandomEditor(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Fieldtech(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) FieldtechFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetFieldtech() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Fieldtech = 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 fsSamplecollectionMods) RandomFieldtech(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Flockid(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) FlockidFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Flockid = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetFlockid() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Flockid = 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 fsSamplecollectionMods) RandomFlockid(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFlockidNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Gatewaysync(val null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) GatewaysyncFunc(f func() null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetGatewaysync() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Gatewaysync = 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 fsSamplecollectionMods) RandomGatewaysync(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Globalid(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) GlobalidFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetGlobalid() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Globalid = 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 fsSamplecollectionMods) RandomGlobalid(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Lab(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Lab = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) LabFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Lab = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetLab() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Lab = 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 fsSamplecollectionMods) RandomLab(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Locationname(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) LocationnameFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetLocationname() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Locationname = 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 fsSamplecollectionMods) RandomLocationname(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) LocID(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LocID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) LocIDFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LocID = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetLocID() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LocID = 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 fsSamplecollectionMods) RandomLocID(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocIDNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Objectid(val int32) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ObjectidFunc(f func() int32) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetObjectid() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSamplecollectionMods) RandomObjectid(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Processed(val null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetProcessed() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Processed = 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 fsSamplecollectionMods) RandomProcessed(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Raingauge(val null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) RaingaugeFunc(f func() null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetRaingauge() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Raingauge = 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 fsSamplecollectionMods) RandomRaingauge(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Recordstatus(val null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) RecordstatusFunc(f func() null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetRecordstatus() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Recordstatus = 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 fsSamplecollectionMods) RandomRecordstatus(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Reviewed(val null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetReviewed() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewed = 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 fsSamplecollectionMods) RandomReviewed(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Reviewedby(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ReviewedbyFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetReviewedby() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewedby = 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 fsSamplecollectionMods) RandomReviewedby(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Revieweddate(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) RevieweddateFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetRevieweddate() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Revieweddate = 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 fsSamplecollectionMods) RandomRevieweddate(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Samplecond(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SamplecondFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecond = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSamplecond() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecond = 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 fsSamplecollectionMods) RandomSamplecond(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSamplecondNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Samplecount(val null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SamplecountFunc(f func() null.Val[int16]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecount = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSamplecount() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecount = 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 fsSamplecollectionMods) RandomSamplecount(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomSamplecountNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Sampleid(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SampleidFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSampleid() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampleid = 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 fsSamplecollectionMods) RandomSampleid(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Sampletype(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SampletypeFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampletype = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSampletype() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampletype = 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 fsSamplecollectionMods) RandomSampletype(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampletypeNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Sex(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sex = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SexFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sex = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSex() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sex = 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 fsSamplecollectionMods) RandomSex(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sex = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSexNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sex = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Sitecond(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SitecondFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSitecond() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sitecond = 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 fsSamplecollectionMods) RandomSitecond(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Species(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SpeciesFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSpecies() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Species = 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 fsSamplecollectionMods) RandomSpecies(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Startdatetime(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetStartdatetime() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Startdatetime = 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 fsSamplecollectionMods) RandomStartdatetime(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Survtech(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) SurvtechFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Survtech = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetSurvtech() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Survtech = 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 fsSamplecollectionMods) RandomSurvtech(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSurvtechNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Testmethod(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) TestmethodFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testmethod = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetTestmethod() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testmethod = 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 fsSamplecollectionMods) RandomTestmethod(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTestmethodNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Testtech(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) TesttechFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testtech = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetTesttech() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testtech = 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 fsSamplecollectionMods) RandomTesttech(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTesttechNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Winddir(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) WinddirFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetWinddir() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Winddir = 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 fsSamplecollectionMods) RandomWinddir(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Windspeed(val null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) WindspeedFunc(f func() null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetWindspeed() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Windspeed = 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 fsSamplecollectionMods) RandomWindspeed(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Zone(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) ZoneFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetZone() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone = 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 fsSamplecollectionMods) RandomZone(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Zone2(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) Zone2Func(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetZone2() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone2 = 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 fsSamplecollectionMods) RandomZone2(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) CreatedDate(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) CreatedDateFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetCreatedDate() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedDate = 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 fsSamplecollectionMods) RandomCreatedDate(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) CreatedUser(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) CreatedUserFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetCreatedUser() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedUser = 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 fsSamplecollectionMods) RandomCreatedUser(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) GeometryX(val null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) GeometryXFunc(f func() null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetGeometryX() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryX = 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 fsSamplecollectionMods) RandomGeometryX(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) GeometryY(val null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) GeometryYFunc(f func() null.Val[float64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetGeometryY() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryY = 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 fsSamplecollectionMods) RandomGeometryY(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) LastEditedDate(val null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetLastEditedDate() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedDate = 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 fsSamplecollectionMods) RandomLastEditedDate(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) LastEditedUser(val null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) LastEditedUserFunc(f func() null.Val[string]) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetLastEditedUser() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedUser = 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 fsSamplecollectionMods) RandomLastEditedUser(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplecollectionMods) Updated(val time.Time) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsSamplecollectionMods) UpdatedFunc(f func() time.Time) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsSamplecollectionMods) UnsetUpdated() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSamplecollectionMods) RandomUpdated(f *faker.Faker) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsSamplecollectionMods) WithParentsCascading() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { + if isDone, _ := fsSamplecollectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsSamplecollectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsSamplecollectionMods) WithOrganization(rel *OrganizationTemplate) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { + o.r.Organization = &fsSamplecollectionROrganizationR{ + o: rel, + } + }) +} + +func (m fsSamplecollectionMods) WithNewOrganization(mods ...OrganizationMod) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsSamplecollectionMods) WithExistingOrganization(em *models.Organization) FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { + o.r.Organization = &fsSamplecollectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsSamplecollectionMods) WithoutOrganization() FSSamplecollectionMod { + return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_samplelocation.bob.go b/factory/fs_samplelocation.bob.go new file mode 100644 index 00000000..050ed6aa --- /dev/null +++ b/factory/fs_samplelocation.bob.go @@ -0,0 +1,1980 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSSamplelocationMod interface { + Apply(context.Context, *FSSamplelocationTemplate) +} + +type FSSamplelocationModFunc func(context.Context, *FSSamplelocationTemplate) + +func (f FSSamplelocationModFunc) Apply(ctx context.Context, n *FSSamplelocationTemplate) { + f(ctx, n) +} + +type FSSamplelocationModSlice []FSSamplelocationMod + +func (mods FSSamplelocationModSlice) Apply(ctx context.Context, n *FSSamplelocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsSamplelocationR + f *Factory + + alreadyPersisted bool +} + +type fsSamplelocationR struct { + Organization *fsSamplelocationROrganizationR +} + +type fsSamplelocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSSamplelocationTemplate +func (o *FSSamplelocationTemplate) Apply(ctx context.Context, mods ...FSSamplelocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSSamplelocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSSamplelocationSetter +// this does nothing with the relationship templates +func (o FSSamplelocationTemplate) BuildSetter() *models.FSSamplelocationSetter { + m := &models.FSSamplelocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSSamplelocationSetter +// this does nothing with the relationship templates +func (o FSSamplelocationTemplate) BuildManySetter(number int) []*models.FSSamplelocationSetter { + m := make([]*models.FSSamplelocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSSamplelocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSamplelocationTemplate.Create +func (o FSSamplelocationTemplate) Build() *models.FSSamplelocation { + m := &models.FSSamplelocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSSamplelocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSamplelocationTemplate.CreateMany +func (o FSSamplelocationTemplate) BuildMany(number int) models.FSSamplelocationSlice { + m := make(models.FSSamplelocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSSamplelocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsSamplelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSSamplelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSamplelocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSSamplelocation(opt) + + m, err := models.FSSamplelocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsSamplelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSSamplelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSamplelocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsSamplelocation 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 *FSSamplelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSamplelocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsSamplelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSSamplelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSamplelocationSlice, error) { + var err error + m := make(models.FSSamplelocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsSamplelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSSamplelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSamplelocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsSamplelocations 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 FSSamplelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSamplelocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSSamplelocation has methods that act as mods for the FSSamplelocationTemplate +var FSSamplelocationMods fsSamplelocationMods + +type fsSamplelocationMods struct{} + +func (m fsSamplelocationMods) RandomizeAllColumns(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModSlice{ + FSSamplelocationMods.RandomOrganizationID(f), + FSSamplelocationMods.RandomAccessdesc(f), + FSSamplelocationMods.RandomActive(f), + FSSamplelocationMods.RandomComments(f), + FSSamplelocationMods.RandomCreationdate(f), + FSSamplelocationMods.RandomCreator(f), + FSSamplelocationMods.RandomDescription(f), + FSSamplelocationMods.RandomExternalid(f), + FSSamplelocationMods.RandomEditdate(f), + FSSamplelocationMods.RandomEditor(f), + FSSamplelocationMods.RandomGatewaysync(f), + FSSamplelocationMods.RandomGlobalid(f), + FSSamplelocationMods.RandomHabitat(f), + FSSamplelocationMods.RandomLocationnumber(f), + FSSamplelocationMods.RandomName(f), + FSSamplelocationMods.RandomNextactiondatescheduled(f), + FSSamplelocationMods.RandomObjectid(f), + FSSamplelocationMods.RandomPriority(f), + FSSamplelocationMods.RandomUsetype(f), + FSSamplelocationMods.RandomZone(f), + FSSamplelocationMods.RandomZone2(f), + FSSamplelocationMods.RandomCreatedDate(f), + FSSamplelocationMods.RandomCreatedUser(f), + FSSamplelocationMods.RandomGeometryX(f), + FSSamplelocationMods.RandomGeometryY(f), + FSSamplelocationMods.RandomLastEditedDate(f), + FSSamplelocationMods.RandomLastEditedUser(f), + FSSamplelocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsSamplelocationMods) OrganizationID(val null.Val[int32]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetOrganizationID() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Accessdesc(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) AccessdescFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetAccessdesc() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Accessdesc = 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 fsSamplelocationMods) RandomAccessdesc(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Active(val null.Val[int16]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) ActiveFunc(f func() null.Val[int16]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetActive() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Active = 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 fsSamplelocationMods) RandomActive(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Comments(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) CommentsFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetComments() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Comments = 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 fsSamplelocationMods) RandomComments(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Creationdate(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) CreationdateFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetCreationdate() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creationdate = 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 fsSamplelocationMods) RandomCreationdate(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Creator(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) CreatorFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetCreator() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creator = 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 fsSamplelocationMods) RandomCreator(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Description(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) DescriptionFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetDescription() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Description = 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 fsSamplelocationMods) RandomDescription(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Externalid(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) ExternalidFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetExternalid() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Externalid = 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 fsSamplelocationMods) RandomExternalid(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Editdate(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) EditdateFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetEditdate() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editdate = 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 fsSamplelocationMods) RandomEditdate(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Editor(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) EditorFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetEditor() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editor = 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 fsSamplelocationMods) RandomEditor(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Gatewaysync(val null.Val[int16]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) GatewaysyncFunc(f func() null.Val[int16]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetGatewaysync() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Gatewaysync = 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 fsSamplelocationMods) RandomGatewaysync(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Globalid(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) GlobalidFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetGlobalid() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Globalid = 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 fsSamplelocationMods) RandomGlobalid(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Habitat(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) HabitatFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetHabitat() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Habitat = 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 fsSamplelocationMods) RandomHabitat(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Locationnumber(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) LocationnumberFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetLocationnumber() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Locationnumber = 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 fsSamplelocationMods) RandomLocationnumber(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Name(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) NameFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetName() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Name = 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 fsSamplelocationMods) RandomName(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Nextactiondatescheduled(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetNextactiondatescheduled() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Nextactiondatescheduled = 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 fsSamplelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Objectid(val int32) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) ObjectidFunc(f func() int32) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetObjectid() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSamplelocationMods) RandomObjectid(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Priority(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) PriorityFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetPriority() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Priority = 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 fsSamplelocationMods) RandomPriority(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Usetype(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) UsetypeFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetUsetype() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Usetype = 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 fsSamplelocationMods) RandomUsetype(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Zone(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) ZoneFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetZone() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone = 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 fsSamplelocationMods) RandomZone(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Zone2(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) Zone2Func(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetZone2() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone2 = 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 fsSamplelocationMods) RandomZone2(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) CreatedDate(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) CreatedDateFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetCreatedDate() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedDate = 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 fsSamplelocationMods) RandomCreatedDate(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) CreatedUser(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) CreatedUserFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetCreatedUser() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedUser = 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 fsSamplelocationMods) RandomCreatedUser(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) GeometryX(val null.Val[float64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) GeometryXFunc(f func() null.Val[float64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetGeometryX() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryX = 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 fsSamplelocationMods) RandomGeometryX(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) GeometryY(val null.Val[float64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) GeometryYFunc(f func() null.Val[float64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetGeometryY() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryY = 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 fsSamplelocationMods) RandomGeometryY(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) LastEditedDate(val null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetLastEditedDate() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedDate = 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 fsSamplelocationMods) RandomLastEditedDate(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) LastEditedUser(val null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) LastEditedUserFunc(f func() null.Val[string]) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetLastEditedUser() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedUser = 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 fsSamplelocationMods) RandomLastEditedUser(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSamplelocationMods) Updated(val time.Time) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsSamplelocationMods) UpdatedFunc(f func() time.Time) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsSamplelocationMods) UnsetUpdated() FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSamplelocationMods) RandomUpdated(f *faker.Faker) FSSamplelocationMod { + return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsSamplelocationMods) WithParentsCascading() FSSamplelocationMod { + return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { + if isDone, _ := fsSamplelocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsSamplelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsSamplelocationMods) WithOrganization(rel *OrganizationTemplate) FSSamplelocationMod { + return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { + o.r.Organization = &fsSamplelocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsSamplelocationMods) WithNewOrganization(mods ...OrganizationMod) FSSamplelocationMod { + return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsSamplelocationMods) WithExistingOrganization(em *models.Organization) FSSamplelocationMod { + return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { + o.r.Organization = &fsSamplelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsSamplelocationMods) WithoutOrganization() FSSamplelocationMod { + return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_servicerequest.bob.go b/factory/fs_servicerequest.bob.go new file mode 100644 index 00000000..9ce7f294 --- /dev/null +++ b/factory/fs_servicerequest.bob.go @@ -0,0 +1,5824 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSServicerequestMod interface { + Apply(context.Context, *FSServicerequestTemplate) +} + +type FSServicerequestModFunc func(context.Context, *FSServicerequestTemplate) + +func (f FSServicerequestModFunc) Apply(ctx context.Context, n *FSServicerequestTemplate) { + f(ctx, n) +} + +type FSServicerequestModSlice []FSServicerequestMod + +func (mods FSServicerequestModSlice) Apply(ctx context.Context, n *FSServicerequestTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accepted func() null.Val[int16] + Acceptedby func() null.Val[string] + Accepteddate func() null.Val[int64] + Allowed func() null.Val[string] + Assignedtech func() null.Val[string] + Clraddr1 func() null.Val[string] + Clraddr2 func() null.Val[string] + Clranon func() null.Val[int16] + Clrcity func() null.Val[string] + Clrcompany func() null.Val[string] + Clrcontpref func() null.Val[string] + Clremail func() null.Val[string] + Clrfname func() null.Val[string] + Clrother func() null.Val[string] + Clrphone1 func() null.Val[string] + Clrphone2 func() null.Val[string] + Clrstate func() null.Val[string] + Clrzip func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datetimeclosed func() null.Val[int64] + Duedate func() null.Val[int64] + Entrytech func() null.Val[string] + Estcompletedate func() null.Val[int64] + Externalerror func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Firstresponsedate func() null.Val[int64] + Globalid func() null.Val[string] + Issuesreported func() null.Val[string] + Jurisdiction func() null.Val[string] + Nextaction func() null.Val[string] + Notificationtimestamp func() null.Val[string] + Notified func() null.Val[int16] + Notifieddate func() null.Val[int64] + Objectid func() int32 + Pointlocid func() null.Val[string] + Priority func() null.Val[string] + Recdatetime func() null.Val[int64] + Recordstatus func() null.Val[int16] + Rejectedby func() null.Val[string] + Rejecteddate func() null.Val[int64] + Rejectedreason func() null.Val[string] + Reqaddr1 func() null.Val[string] + Reqaddr2 func() null.Val[string] + Reqcity func() null.Val[string] + Reqcompany func() null.Val[string] + Reqcrossst func() null.Val[string] + Reqdescr func() null.Val[string] + Reqfldnotes func() null.Val[string] + Reqmapgrid func() null.Val[string] + Reqnotesforcust func() null.Val[string] + Reqnotesfortech func() null.Val[string] + Reqpermission func() null.Val[int16] + Reqprogramactions func() null.Val[string] + Reqstate func() null.Val[string] + Reqsubdiv func() null.Val[string] + Reqtarget func() null.Val[string] + Reqzip func() null.Val[string] + Responsedaycount func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Scheduled func() null.Val[int16] + Scheduleddate func() null.Val[int64] + Source func() null.Val[string] + SRNumber func() null.Val[int64] + Status func() null.Val[string] + Supervisor func() null.Val[string] + Techclosed func() null.Val[string] + Validx func() null.Val[string] + Validy func() null.Val[string] + Xvalue func() null.Val[string] + Yvalue func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Dog func() null.Val[int64] + Spanish func() null.Val[int64] + ScheduleNotes func() null.Val[string] + SchedulePeriod func() null.Val[string] + Updated func() time.Time + + r fsServicerequestR + f *Factory + + alreadyPersisted bool +} + +type fsServicerequestR struct { + Organization *fsServicerequestROrganizationR +} + +type fsServicerequestROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSServicerequestTemplate +func (o *FSServicerequestTemplate) Apply(ctx context.Context, mods ...FSServicerequestMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSServicerequest +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSServicerequestSetter +// this does nothing with the relationship templates +func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter { + m := &models.FSServicerequestSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accepted != nil { + val := o.Accepted() + m.Accepted = omitnull.FromNull(val) + } + if o.Acceptedby != nil { + val := o.Acceptedby() + m.Acceptedby = omitnull.FromNull(val) + } + if o.Accepteddate != nil { + val := o.Accepteddate() + m.Accepteddate = omitnull.FromNull(val) + } + if o.Allowed != nil { + val := o.Allowed() + m.Allowed = omitnull.FromNull(val) + } + if o.Assignedtech != nil { + val := o.Assignedtech() + m.Assignedtech = omitnull.FromNull(val) + } + if o.Clraddr1 != nil { + val := o.Clraddr1() + m.Clraddr1 = omitnull.FromNull(val) + } + if o.Clraddr2 != nil { + val := o.Clraddr2() + m.Clraddr2 = omitnull.FromNull(val) + } + if o.Clranon != nil { + val := o.Clranon() + m.Clranon = omitnull.FromNull(val) + } + if o.Clrcity != nil { + val := o.Clrcity() + m.Clrcity = omitnull.FromNull(val) + } + if o.Clrcompany != nil { + val := o.Clrcompany() + m.Clrcompany = omitnull.FromNull(val) + } + if o.Clrcontpref != nil { + val := o.Clrcontpref() + m.Clrcontpref = omitnull.FromNull(val) + } + if o.Clremail != nil { + val := o.Clremail() + m.Clremail = omitnull.FromNull(val) + } + if o.Clrfname != nil { + val := o.Clrfname() + m.Clrfname = omitnull.FromNull(val) + } + if o.Clrother != nil { + val := o.Clrother() + m.Clrother = omitnull.FromNull(val) + } + if o.Clrphone1 != nil { + val := o.Clrphone1() + m.Clrphone1 = omitnull.FromNull(val) + } + if o.Clrphone2 != nil { + val := o.Clrphone2() + m.Clrphone2 = omitnull.FromNull(val) + } + if o.Clrstate != nil { + val := o.Clrstate() + m.Clrstate = omitnull.FromNull(val) + } + if o.Clrzip != nil { + val := o.Clrzip() + m.Clrzip = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datetimeclosed != nil { + val := o.Datetimeclosed() + m.Datetimeclosed = omitnull.FromNull(val) + } + if o.Duedate != nil { + val := o.Duedate() + m.Duedate = omitnull.FromNull(val) + } + if o.Entrytech != nil { + val := o.Entrytech() + m.Entrytech = omitnull.FromNull(val) + } + if o.Estcompletedate != nil { + val := o.Estcompletedate() + m.Estcompletedate = omitnull.FromNull(val) + } + if o.Externalerror != nil { + val := o.Externalerror() + m.Externalerror = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Firstresponsedate != nil { + val := o.Firstresponsedate() + m.Firstresponsedate = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Issuesreported != nil { + val := o.Issuesreported() + m.Issuesreported = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Nextaction != nil { + val := o.Nextaction() + m.Nextaction = omitnull.FromNull(val) + } + if o.Notificationtimestamp != nil { + val := o.Notificationtimestamp() + m.Notificationtimestamp = omitnull.FromNull(val) + } + if o.Notified != nil { + val := o.Notified() + m.Notified = omitnull.FromNull(val) + } + if o.Notifieddate != nil { + val := o.Notifieddate() + m.Notifieddate = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Recdatetime != nil { + val := o.Recdatetime() + m.Recdatetime = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Rejectedby != nil { + val := o.Rejectedby() + m.Rejectedby = omitnull.FromNull(val) + } + if o.Rejecteddate != nil { + val := o.Rejecteddate() + m.Rejecteddate = omitnull.FromNull(val) + } + if o.Rejectedreason != nil { + val := o.Rejectedreason() + m.Rejectedreason = omitnull.FromNull(val) + } + if o.Reqaddr1 != nil { + val := o.Reqaddr1() + m.Reqaddr1 = omitnull.FromNull(val) + } + if o.Reqaddr2 != nil { + val := o.Reqaddr2() + m.Reqaddr2 = omitnull.FromNull(val) + } + if o.Reqcity != nil { + val := o.Reqcity() + m.Reqcity = omitnull.FromNull(val) + } + if o.Reqcompany != nil { + val := o.Reqcompany() + m.Reqcompany = omitnull.FromNull(val) + } + if o.Reqcrossst != nil { + val := o.Reqcrossst() + m.Reqcrossst = omitnull.FromNull(val) + } + if o.Reqdescr != nil { + val := o.Reqdescr() + m.Reqdescr = omitnull.FromNull(val) + } + if o.Reqfldnotes != nil { + val := o.Reqfldnotes() + m.Reqfldnotes = omitnull.FromNull(val) + } + if o.Reqmapgrid != nil { + val := o.Reqmapgrid() + m.Reqmapgrid = omitnull.FromNull(val) + } + if o.Reqnotesforcust != nil { + val := o.Reqnotesforcust() + m.Reqnotesforcust = omitnull.FromNull(val) + } + if o.Reqnotesfortech != nil { + val := o.Reqnotesfortech() + m.Reqnotesfortech = omitnull.FromNull(val) + } + if o.Reqpermission != nil { + val := o.Reqpermission() + m.Reqpermission = omitnull.FromNull(val) + } + if o.Reqprogramactions != nil { + val := o.Reqprogramactions() + m.Reqprogramactions = omitnull.FromNull(val) + } + if o.Reqstate != nil { + val := o.Reqstate() + m.Reqstate = omitnull.FromNull(val) + } + if o.Reqsubdiv != nil { + val := o.Reqsubdiv() + m.Reqsubdiv = omitnull.FromNull(val) + } + if o.Reqtarget != nil { + val := o.Reqtarget() + m.Reqtarget = omitnull.FromNull(val) + } + if o.Reqzip != nil { + val := o.Reqzip() + m.Reqzip = omitnull.FromNull(val) + } + if o.Responsedaycount != nil { + val := o.Responsedaycount() + m.Responsedaycount = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Scheduled != nil { + val := o.Scheduled() + m.Scheduled = omitnull.FromNull(val) + } + if o.Scheduleddate != nil { + val := o.Scheduleddate() + m.Scheduleddate = omitnull.FromNull(val) + } + if o.Source != nil { + val := o.Source() + m.Source = omitnull.FromNull(val) + } + if o.SRNumber != nil { + val := o.SRNumber() + m.SRNumber = omitnull.FromNull(val) + } + if o.Status != nil { + val := o.Status() + m.Status = omitnull.FromNull(val) + } + if o.Supervisor != nil { + val := o.Supervisor() + m.Supervisor = omitnull.FromNull(val) + } + if o.Techclosed != nil { + val := o.Techclosed() + m.Techclosed = omitnull.FromNull(val) + } + if o.Validx != nil { + val := o.Validx() + m.Validx = omitnull.FromNull(val) + } + if o.Validy != nil { + val := o.Validy() + m.Validy = omitnull.FromNull(val) + } + if o.Xvalue != nil { + val := o.Xvalue() + m.Xvalue = omitnull.FromNull(val) + } + if o.Yvalue != nil { + val := o.Yvalue() + m.Yvalue = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Dog != nil { + val := o.Dog() + m.Dog = omitnull.FromNull(val) + } + if o.Spanish != nil { + val := o.Spanish() + m.Spanish = omitnull.FromNull(val) + } + if o.ScheduleNotes != nil { + val := o.ScheduleNotes() + m.ScheduleNotes = omitnull.FromNull(val) + } + if o.SchedulePeriod != nil { + val := o.SchedulePeriod() + m.SchedulePeriod = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSServicerequestSetter +// this does nothing with the relationship templates +func (o FSServicerequestTemplate) BuildManySetter(number int) []*models.FSServicerequestSetter { + m := make([]*models.FSServicerequestSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSServicerequest +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSServicerequestTemplate.Create +func (o FSServicerequestTemplate) Build() *models.FSServicerequest { + m := &models.FSServicerequest{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accepted != nil { + m.Accepted = o.Accepted() + } + if o.Acceptedby != nil { + m.Acceptedby = o.Acceptedby() + } + if o.Accepteddate != nil { + m.Accepteddate = o.Accepteddate() + } + if o.Allowed != nil { + m.Allowed = o.Allowed() + } + if o.Assignedtech != nil { + m.Assignedtech = o.Assignedtech() + } + if o.Clraddr1 != nil { + m.Clraddr1 = o.Clraddr1() + } + if o.Clraddr2 != nil { + m.Clraddr2 = o.Clraddr2() + } + if o.Clranon != nil { + m.Clranon = o.Clranon() + } + if o.Clrcity != nil { + m.Clrcity = o.Clrcity() + } + if o.Clrcompany != nil { + m.Clrcompany = o.Clrcompany() + } + if o.Clrcontpref != nil { + m.Clrcontpref = o.Clrcontpref() + } + if o.Clremail != nil { + m.Clremail = o.Clremail() + } + if o.Clrfname != nil { + m.Clrfname = o.Clrfname() + } + if o.Clrother != nil { + m.Clrother = o.Clrother() + } + if o.Clrphone1 != nil { + m.Clrphone1 = o.Clrphone1() + } + if o.Clrphone2 != nil { + m.Clrphone2 = o.Clrphone2() + } + if o.Clrstate != nil { + m.Clrstate = o.Clrstate() + } + if o.Clrzip != nil { + m.Clrzip = o.Clrzip() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datetimeclosed != nil { + m.Datetimeclosed = o.Datetimeclosed() + } + if o.Duedate != nil { + m.Duedate = o.Duedate() + } + if o.Entrytech != nil { + m.Entrytech = o.Entrytech() + } + if o.Estcompletedate != nil { + m.Estcompletedate = o.Estcompletedate() + } + if o.Externalerror != nil { + m.Externalerror = o.Externalerror() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Firstresponsedate != nil { + m.Firstresponsedate = o.Firstresponsedate() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Issuesreported != nil { + m.Issuesreported = o.Issuesreported() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Nextaction != nil { + m.Nextaction = o.Nextaction() + } + if o.Notificationtimestamp != nil { + m.Notificationtimestamp = o.Notificationtimestamp() + } + if o.Notified != nil { + m.Notified = o.Notified() + } + if o.Notifieddate != nil { + m.Notifieddate = o.Notifieddate() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Recdatetime != nil { + m.Recdatetime = o.Recdatetime() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Rejectedby != nil { + m.Rejectedby = o.Rejectedby() + } + if o.Rejecteddate != nil { + m.Rejecteddate = o.Rejecteddate() + } + if o.Rejectedreason != nil { + m.Rejectedreason = o.Rejectedreason() + } + if o.Reqaddr1 != nil { + m.Reqaddr1 = o.Reqaddr1() + } + if o.Reqaddr2 != nil { + m.Reqaddr2 = o.Reqaddr2() + } + if o.Reqcity != nil { + m.Reqcity = o.Reqcity() + } + if o.Reqcompany != nil { + m.Reqcompany = o.Reqcompany() + } + if o.Reqcrossst != nil { + m.Reqcrossst = o.Reqcrossst() + } + if o.Reqdescr != nil { + m.Reqdescr = o.Reqdescr() + } + if o.Reqfldnotes != nil { + m.Reqfldnotes = o.Reqfldnotes() + } + if o.Reqmapgrid != nil { + m.Reqmapgrid = o.Reqmapgrid() + } + if o.Reqnotesforcust != nil { + m.Reqnotesforcust = o.Reqnotesforcust() + } + if o.Reqnotesfortech != nil { + m.Reqnotesfortech = o.Reqnotesfortech() + } + if o.Reqpermission != nil { + m.Reqpermission = o.Reqpermission() + } + if o.Reqprogramactions != nil { + m.Reqprogramactions = o.Reqprogramactions() + } + if o.Reqstate != nil { + m.Reqstate = o.Reqstate() + } + if o.Reqsubdiv != nil { + m.Reqsubdiv = o.Reqsubdiv() + } + if o.Reqtarget != nil { + m.Reqtarget = o.Reqtarget() + } + if o.Reqzip != nil { + m.Reqzip = o.Reqzip() + } + if o.Responsedaycount != nil { + m.Responsedaycount = o.Responsedaycount() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Scheduled != nil { + m.Scheduled = o.Scheduled() + } + if o.Scheduleddate != nil { + m.Scheduleddate = o.Scheduleddate() + } + if o.Source != nil { + m.Source = o.Source() + } + if o.SRNumber != nil { + m.SRNumber = o.SRNumber() + } + if o.Status != nil { + m.Status = o.Status() + } + if o.Supervisor != nil { + m.Supervisor = o.Supervisor() + } + if o.Techclosed != nil { + m.Techclosed = o.Techclosed() + } + if o.Validx != nil { + m.Validx = o.Validx() + } + if o.Validy != nil { + m.Validy = o.Validy() + } + if o.Xvalue != nil { + m.Xvalue = o.Xvalue() + } + if o.Yvalue != nil { + m.Yvalue = o.Yvalue() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Dog != nil { + m.Dog = o.Dog() + } + if o.Spanish != nil { + m.Spanish = o.Spanish() + } + if o.ScheduleNotes != nil { + m.ScheduleNotes = o.ScheduleNotes() + } + if o.SchedulePeriod != nil { + m.SchedulePeriod = o.SchedulePeriod() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSServicerequestSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSServicerequestTemplate.CreateMany +func (o FSServicerequestTemplate) BuildMany(number int) models.FSServicerequestSlice { + m := make(models.FSServicerequestSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSServicerequest +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsServicerequest and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSServicerequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSServicerequest, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSServicerequest(opt) + + m, err := models.FSServicerequests.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsServicerequest and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSServicerequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSServicerequest { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsServicerequest 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 *FSServicerequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSServicerequest { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsServicerequests and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSServicerequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSServicerequestSlice, error) { + var err error + m := make(models.FSServicerequestSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsServicerequests and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSServicerequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSServicerequestSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsServicerequests 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 FSServicerequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSServicerequestSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSServicerequest has methods that act as mods for the FSServicerequestTemplate +var FSServicerequestMods fsServicerequestMods + +type fsServicerequestMods struct{} + +func (m fsServicerequestMods) RandomizeAllColumns(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModSlice{ + FSServicerequestMods.RandomOrganizationID(f), + FSServicerequestMods.RandomAccepted(f), + FSServicerequestMods.RandomAcceptedby(f), + FSServicerequestMods.RandomAccepteddate(f), + FSServicerequestMods.RandomAllowed(f), + FSServicerequestMods.RandomAssignedtech(f), + FSServicerequestMods.RandomClraddr1(f), + FSServicerequestMods.RandomClraddr2(f), + FSServicerequestMods.RandomClranon(f), + FSServicerequestMods.RandomClrcity(f), + FSServicerequestMods.RandomClrcompany(f), + FSServicerequestMods.RandomClrcontpref(f), + FSServicerequestMods.RandomClremail(f), + FSServicerequestMods.RandomClrfname(f), + FSServicerequestMods.RandomClrother(f), + FSServicerequestMods.RandomClrphone1(f), + FSServicerequestMods.RandomClrphone2(f), + FSServicerequestMods.RandomClrstate(f), + FSServicerequestMods.RandomClrzip(f), + FSServicerequestMods.RandomComments(f), + FSServicerequestMods.RandomCreationdate(f), + FSServicerequestMods.RandomCreator(f), + FSServicerequestMods.RandomDatetimeclosed(f), + FSServicerequestMods.RandomDuedate(f), + FSServicerequestMods.RandomEntrytech(f), + FSServicerequestMods.RandomEstcompletedate(f), + FSServicerequestMods.RandomExternalerror(f), + FSServicerequestMods.RandomExternalid(f), + FSServicerequestMods.RandomEditdate(f), + FSServicerequestMods.RandomEditor(f), + FSServicerequestMods.RandomFirstresponsedate(f), + FSServicerequestMods.RandomGlobalid(f), + FSServicerequestMods.RandomIssuesreported(f), + FSServicerequestMods.RandomJurisdiction(f), + FSServicerequestMods.RandomNextaction(f), + FSServicerequestMods.RandomNotificationtimestamp(f), + FSServicerequestMods.RandomNotified(f), + FSServicerequestMods.RandomNotifieddate(f), + FSServicerequestMods.RandomObjectid(f), + FSServicerequestMods.RandomPointlocid(f), + FSServicerequestMods.RandomPriority(f), + FSServicerequestMods.RandomRecdatetime(f), + FSServicerequestMods.RandomRecordstatus(f), + FSServicerequestMods.RandomRejectedby(f), + FSServicerequestMods.RandomRejecteddate(f), + FSServicerequestMods.RandomRejectedreason(f), + FSServicerequestMods.RandomReqaddr1(f), + FSServicerequestMods.RandomReqaddr2(f), + FSServicerequestMods.RandomReqcity(f), + FSServicerequestMods.RandomReqcompany(f), + FSServicerequestMods.RandomReqcrossst(f), + FSServicerequestMods.RandomReqdescr(f), + FSServicerequestMods.RandomReqfldnotes(f), + FSServicerequestMods.RandomReqmapgrid(f), + FSServicerequestMods.RandomReqnotesforcust(f), + FSServicerequestMods.RandomReqnotesfortech(f), + FSServicerequestMods.RandomReqpermission(f), + FSServicerequestMods.RandomReqprogramactions(f), + FSServicerequestMods.RandomReqstate(f), + FSServicerequestMods.RandomReqsubdiv(f), + FSServicerequestMods.RandomReqtarget(f), + FSServicerequestMods.RandomReqzip(f), + FSServicerequestMods.RandomResponsedaycount(f), + FSServicerequestMods.RandomReviewed(f), + FSServicerequestMods.RandomReviewedby(f), + FSServicerequestMods.RandomRevieweddate(f), + FSServicerequestMods.RandomScheduled(f), + FSServicerequestMods.RandomScheduleddate(f), + FSServicerequestMods.RandomSource(f), + FSServicerequestMods.RandomSRNumber(f), + FSServicerequestMods.RandomStatus(f), + FSServicerequestMods.RandomSupervisor(f), + FSServicerequestMods.RandomTechclosed(f), + FSServicerequestMods.RandomValidx(f), + FSServicerequestMods.RandomValidy(f), + FSServicerequestMods.RandomXvalue(f), + FSServicerequestMods.RandomYvalue(f), + FSServicerequestMods.RandomZone(f), + FSServicerequestMods.RandomZone2(f), + FSServicerequestMods.RandomCreatedDate(f), + FSServicerequestMods.RandomCreatedUser(f), + FSServicerequestMods.RandomGeometryX(f), + FSServicerequestMods.RandomGeometryY(f), + FSServicerequestMods.RandomLastEditedDate(f), + FSServicerequestMods.RandomLastEditedUser(f), + FSServicerequestMods.RandomDog(f), + FSServicerequestMods.RandomSpanish(f), + FSServicerequestMods.RandomScheduleNotes(f), + FSServicerequestMods.RandomSchedulePeriod(f), + FSServicerequestMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsServicerequestMods) OrganizationID(val null.Val[int32]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) OrganizationIDFunc(f func() null.Val[int32]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetOrganizationID() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Accepted(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) AcceptedFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepted = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetAccepted() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepted = 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 fsServicerequestMods) RandomAccepted(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomAcceptedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Acceptedby(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) AcceptedbyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Acceptedby = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetAcceptedby() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Acceptedby = 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 fsServicerequestMods) RandomAcceptedby(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAcceptedbyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Accepteddate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) AccepteddateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepteddate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetAccepteddate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepteddate = 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 fsServicerequestMods) RandomAccepteddate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomAccepteddateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Allowed(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Allowed = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) AllowedFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Allowed = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetAllowed() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Allowed = 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 fsServicerequestMods) RandomAllowed(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Allowed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAllowedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Allowed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Assignedtech(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) AssignedtechFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Assignedtech = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetAssignedtech() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Assignedtech = 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 fsServicerequestMods) RandomAssignedtech(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAssignedtechNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clraddr1(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Clraddr1Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr1 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClraddr1() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr1 = 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 fsServicerequestMods) RandomClraddr1(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClraddr1NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clraddr2(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Clraddr2Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr2 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClraddr2() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr2 = 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 fsServicerequestMods) RandomClraddr2(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClraddr2NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clranon(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClranonFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clranon = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClranon() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clranon = 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 fsServicerequestMods) RandomClranon(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomClranonNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrcity(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrcityFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcity = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrcity() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcity = 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 fsServicerequestMods) RandomClrcity(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcityNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrcompany(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrcompanyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcompany = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrcompany() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcompany = 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 fsServicerequestMods) RandomClrcompany(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcompanyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrcontpref(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcontpref = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrcontpref() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcontpref = 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 fsServicerequestMods) RandomClrcontpref(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcontprefNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clremail(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clremail = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClremailFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clremail = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClremail() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clremail = 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 fsServicerequestMods) RandomClremail(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clremail = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClremailNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clremail = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrfname(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrfnameFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrfname = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrfname() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrfname = 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 fsServicerequestMods) RandomClrfname(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrfnameNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrother(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrother = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrotherFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrother = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrother() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrother = 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 fsServicerequestMods) RandomClrother(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrother = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrotherNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrother = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrphone1(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Clrphone1Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone1 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrphone1() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone1 = 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 fsServicerequestMods) RandomClrphone1(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrphone1NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrphone2(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Clrphone2Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone2 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrphone2() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone2 = 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 fsServicerequestMods) RandomClrphone2(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrphone2NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrstate(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrstateFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrstate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrstate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrstate = 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 fsServicerequestMods) RandomClrstate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrstateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Clrzip(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ClrzipFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrzip = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetClrzip() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrzip = 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 fsServicerequestMods) RandomClrzip(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrzipNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Comments(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) CommentsFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetComments() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Comments = 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 fsServicerequestMods) RandomComments(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Creationdate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) CreationdateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetCreationdate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creationdate = 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 fsServicerequestMods) RandomCreationdate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Creator(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) CreatorFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetCreator() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creator = 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 fsServicerequestMods) RandomCreator(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Datetimeclosed(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) DatetimeclosedFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Datetimeclosed = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetDatetimeclosed() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Datetimeclosed = 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 fsServicerequestMods) RandomDatetimeclosed(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetimeclosedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Duedate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) DuedateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Duedate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetDuedate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Duedate = 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 fsServicerequestMods) RandomDuedate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Entrytech(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) EntrytechFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Entrytech = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetEntrytech() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Entrytech = 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 fsServicerequestMods) RandomEntrytech(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEntrytechNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Estcompletedate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) EstcompletedateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Estcompletedate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetEstcompletedate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Estcompletedate = 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 fsServicerequestMods) RandomEstcompletedate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEstcompletedateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Externalerror(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ExternalerrorFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalerror = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetExternalerror() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalerror = 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 fsServicerequestMods) RandomExternalerror(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalerrorNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Externalid(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ExternalidFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetExternalid() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalid = 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 fsServicerequestMods) RandomExternalid(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Editdate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) EditdateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetEditdate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editdate = 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 fsServicerequestMods) RandomEditdate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Editor(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) EditorFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetEditor() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editor = 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 fsServicerequestMods) RandomEditor(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Firstresponsedate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) FirstresponsedateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Firstresponsedate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetFirstresponsedate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Firstresponsedate = 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 fsServicerequestMods) RandomFirstresponsedate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFirstresponsedateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Globalid(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) GlobalidFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetGlobalid() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Globalid = 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 fsServicerequestMods) RandomGlobalid(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Issuesreported(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Issuesreported = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetIssuesreported() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Issuesreported = 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 fsServicerequestMods) RandomIssuesreported(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIssuesreportedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Jurisdiction(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) JurisdictionFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetJurisdiction() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Jurisdiction = 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 fsServicerequestMods) RandomJurisdiction(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Nextaction(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) NextactionFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Nextaction = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetNextaction() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Nextaction = 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 fsServicerequestMods) RandomNextaction(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNextactionNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Notificationtimestamp(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) NotificationtimestampFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notificationtimestamp = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetNotificationtimestamp() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notificationtimestamp = 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 fsServicerequestMods) RandomNotificationtimestamp(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNotificationtimestampNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Notified(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notified = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) NotifiedFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notified = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetNotified() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notified = 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 fsServicerequestMods) RandomNotified(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Notifieddate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) NotifieddateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notifieddate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetNotifieddate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notifieddate = 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 fsServicerequestMods) RandomNotifieddate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNotifieddateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Objectid(val int32) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ObjectidFunc(f func() int32) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetObjectid() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsServicerequestMods) RandomObjectid(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Pointlocid(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) PointlocidFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetPointlocid() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Pointlocid = 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 fsServicerequestMods) RandomPointlocid(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Priority(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) PriorityFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetPriority() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Priority = 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 fsServicerequestMods) RandomPriority(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Recdatetime(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RecdatetimeFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recdatetime = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRecdatetime() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recdatetime = 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 fsServicerequestMods) RandomRecdatetime(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRecdatetimeNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Recordstatus(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RecordstatusFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRecordstatus() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recordstatus = 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 fsServicerequestMods) RandomRecordstatus(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Rejectedby(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RejectedbyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedby = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRejectedby() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedby = 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 fsServicerequestMods) RandomRejectedby(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRejectedbyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Rejecteddate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RejecteddateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejecteddate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRejecteddate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejecteddate = 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 fsServicerequestMods) RandomRejecteddate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRejecteddateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Rejectedreason(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedreason = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRejectedreason() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedreason = 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 fsServicerequestMods) RandomRejectedreason(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRejectedreasonNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqaddr1(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Reqaddr1Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr1 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqaddr1() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr1 = 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 fsServicerequestMods) RandomReqaddr1(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqaddr1NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqaddr2(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Reqaddr2Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr2 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqaddr2() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr2 = 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 fsServicerequestMods) RandomReqaddr2(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqaddr2NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqcity(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqcityFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcity = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqcity() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcity = 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 fsServicerequestMods) RandomReqcity(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcityNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqcompany(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqcompanyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcompany = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqcompany() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcompany = 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 fsServicerequestMods) RandomReqcompany(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcompanyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqcrossst(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqcrossstFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcrossst = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqcrossst() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcrossst = 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 fsServicerequestMods) RandomReqcrossst(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcrossstNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqdescr(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqdescrFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqdescr = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqdescr() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqdescr = 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 fsServicerequestMods) RandomReqdescr(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqdescrNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqfldnotes(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqfldnotesFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqfldnotes = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqfldnotes() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqfldnotes = 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 fsServicerequestMods) RandomReqfldnotes(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqfldnotesNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqmapgrid(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqmapgridFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqmapgrid = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqmapgrid() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqmapgrid = 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 fsServicerequestMods) RandomReqmapgrid(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqmapgridNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqnotesforcust(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqnotesforcustFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesforcust = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqnotesforcust() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesforcust = 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 fsServicerequestMods) RandomReqnotesforcust(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqnotesforcustNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqnotesfortech(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqnotesfortechFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesfortech = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqnotesfortech() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesfortech = 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 fsServicerequestMods) RandomReqnotesfortech(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqnotesfortechNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqpermission(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqpermission = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqpermission() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqpermission = 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 fsServicerequestMods) RandomReqpermission(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReqpermissionNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqprogramactions(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqprogramactionsFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqprogramactions = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqprogramactions() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqprogramactions = 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 fsServicerequestMods) RandomReqprogramactions(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqprogramactionsNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqstate(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqstateFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqstate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqstate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqstate = 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 fsServicerequestMods) RandomReqstate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqstateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqsubdiv(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqsubdivFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqsubdiv = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqsubdiv() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqsubdiv = 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 fsServicerequestMods) RandomReqsubdiv(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqsubdivNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqtarget(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqtargetFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqtarget = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqtarget() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqtarget = 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 fsServicerequestMods) RandomReqtarget(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqtargetNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reqzip(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReqzipFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqzip = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReqzip() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqzip = 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 fsServicerequestMods) RandomReqzip(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqzipNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Responsedaycount(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ResponsedaycountFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Responsedaycount = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetResponsedaycount() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Responsedaycount = 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 fsServicerequestMods) RandomResponsedaycount(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomResponsedaycountNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reviewed(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReviewedFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReviewed() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewed = 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 fsServicerequestMods) RandomReviewed(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Reviewedby(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ReviewedbyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetReviewedby() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewedby = 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 fsServicerequestMods) RandomReviewedby(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Revieweddate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) RevieweddateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetRevieweddate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Revieweddate = 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 fsServicerequestMods) RandomRevieweddate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Scheduled(val null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ScheduledFunc(f func() null.Val[int16]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduled = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetScheduled() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduled = 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 fsServicerequestMods) RandomScheduled(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomScheduledNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Scheduleddate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ScheduleddateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduleddate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetScheduleddate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduleddate = 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 fsServicerequestMods) RandomScheduleddate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomScheduleddateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Source(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Source = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) SourceFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Source = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetSource() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Source = 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 fsServicerequestMods) RandomSource(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Source = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourceNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Source = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) SRNumber(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) SRNumberFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SRNumber = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetSRNumber() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SRNumber = 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 fsServicerequestMods) RandomSRNumber(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSRNumberNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Status(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Status = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) StatusFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Status = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetStatus() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Status = 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 fsServicerequestMods) RandomStatus(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Status = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomStatusNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Status = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Supervisor(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) SupervisorFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Supervisor = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetSupervisor() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Supervisor = 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 fsServicerequestMods) RandomSupervisor(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSupervisorNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Techclosed(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) TechclosedFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Techclosed = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetTechclosed() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Techclosed = 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 fsServicerequestMods) RandomTechclosed(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTechclosedNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Validx(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validx = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ValidxFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validx = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetValidx() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validx = 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 fsServicerequestMods) RandomValidx(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validx = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomValidxNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validx = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Validy(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validy = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ValidyFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validy = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetValidy() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validy = 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 fsServicerequestMods) RandomValidy(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validy = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomValidyNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Validy = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Xvalue(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) XvalueFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Xvalue = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetXvalue() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Xvalue = 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 fsServicerequestMods) RandomXvalue(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomXvalueNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Yvalue(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) YvalueFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Yvalue = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetYvalue() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Yvalue = 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 fsServicerequestMods) RandomYvalue(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomYvalueNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Zone(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ZoneFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetZone() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone = 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 fsServicerequestMods) RandomZone(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Zone2(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) Zone2Func(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetZone2() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone2 = 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 fsServicerequestMods) RandomZone2(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) CreatedDate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) CreatedDateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetCreatedDate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedDate = 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 fsServicerequestMods) RandomCreatedDate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) CreatedUser(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) CreatedUserFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetCreatedUser() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedUser = 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 fsServicerequestMods) RandomCreatedUser(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) GeometryX(val null.Val[float64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) GeometryXFunc(f func() null.Val[float64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetGeometryX() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryX = 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 fsServicerequestMods) RandomGeometryX(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) GeometryY(val null.Val[float64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) GeometryYFunc(f func() null.Val[float64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetGeometryY() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryY = 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 fsServicerequestMods) RandomGeometryY(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) LastEditedDate(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) LastEditedDateFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetLastEditedDate() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedDate = 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 fsServicerequestMods) RandomLastEditedDate(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) LastEditedUser(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) LastEditedUserFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetLastEditedUser() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedUser = 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 fsServicerequestMods) RandomLastEditedUser(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Dog(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Dog = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) DogFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Dog = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetDog() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Dog = 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 fsServicerequestMods) RandomDog(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Dog = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDogNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Dog = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Spanish(val null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) SpanishFunc(f func() null.Val[int64]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Spanish = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetSpanish() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Spanish = 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 fsServicerequestMods) RandomSpanish(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSpanishNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) ScheduleNotes(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) ScheduleNotesFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.ScheduleNotes = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetScheduleNotes() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.ScheduleNotes = 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 fsServicerequestMods) RandomScheduleNotes(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomScheduleNotesNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) SchedulePeriod(val null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SchedulePeriod = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetSchedulePeriod() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SchedulePeriod = 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 fsServicerequestMods) RandomSchedulePeriod(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSchedulePeriodNotNull(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsServicerequestMods) Updated(val time.Time) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsServicerequestMods) UpdatedFunc(f func() time.Time) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsServicerequestMods) UnsetUpdated() FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsServicerequestMods) RandomUpdated(f *faker.Faker) FSServicerequestMod { + return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsServicerequestMods) WithParentsCascading() FSServicerequestMod { + return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { + if isDone, _ := fsServicerequestWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsServicerequestWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsServicerequestMods) WithOrganization(rel *OrganizationTemplate) FSServicerequestMod { + return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { + o.r.Organization = &fsServicerequestROrganizationR{ + o: rel, + } + }) +} + +func (m fsServicerequestMods) WithNewOrganization(mods ...OrganizationMod) FSServicerequestMod { + return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsServicerequestMods) WithExistingOrganization(em *models.Organization) FSServicerequestMod { + return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { + o.r.Organization = &fsServicerequestROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsServicerequestMods) WithoutOrganization() FSServicerequestMod { + return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_speciesabundance.bob.go b/factory/fs_speciesabundance.bob.go new file mode 100644 index 00000000..860197b2 --- /dev/null +++ b/factory/fs_speciesabundance.bob.go @@ -0,0 +1,2290 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSSpeciesabundanceMod interface { + Apply(context.Context, *FSSpeciesabundanceTemplate) +} + +type FSSpeciesabundanceModFunc func(context.Context, *FSSpeciesabundanceTemplate) + +func (f FSSpeciesabundanceModFunc) Apply(ctx context.Context, n *FSSpeciesabundanceTemplate) { + f(ctx, n) +} + +type FSSpeciesabundanceModSlice []FSSpeciesabundanceMod + +func (mods FSSpeciesabundanceModSlice) Apply(ctx context.Context, n *FSSpeciesabundanceTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Bloodedfem func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Eggs func() null.Val[int16] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Females func() null.Val[int64] + Gravidfem func() null.Val[int16] + Globalid func() null.Val[string] + Larvae func() null.Val[int16] + Males func() null.Val[int16] + Objectid func() int32 + Poolstogen func() null.Val[int16] + Processed func() null.Val[int16] + Pupae func() null.Val[int16] + Species func() null.Val[string] + Total func() null.Val[int64] + TrapdataID func() null.Val[string] + Unknown func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Globalzscore func() null.Val[float64] + H3R7 func() null.Val[string] + H3R8 func() null.Val[string] + R7score func() null.Val[float64] + R8score func() null.Val[float64] + Yearweek func() null.Val[int64] + Updated func() time.Time + + r fsSpeciesabundanceR + f *Factory + + alreadyPersisted bool +} + +type fsSpeciesabundanceR struct { + Organization *fsSpeciesabundanceROrganizationR +} + +type fsSpeciesabundanceROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSSpeciesabundanceTemplate +func (o *FSSpeciesabundanceTemplate) Apply(ctx context.Context, mods ...FSSpeciesabundanceMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSSpeciesabundance +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSSpeciesabundanceSetter +// this does nothing with the relationship templates +func (o FSSpeciesabundanceTemplate) BuildSetter() *models.FSSpeciesabundanceSetter { + m := &models.FSSpeciesabundanceSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Bloodedfem != nil { + val := o.Bloodedfem() + m.Bloodedfem = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Eggs != nil { + val := o.Eggs() + m.Eggs = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Females != nil { + val := o.Females() + m.Females = omitnull.FromNull(val) + } + if o.Gravidfem != nil { + val := o.Gravidfem() + m.Gravidfem = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Larvae != nil { + val := o.Larvae() + m.Larvae = omitnull.FromNull(val) + } + if o.Males != nil { + val := o.Males() + m.Males = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Poolstogen != nil { + val := o.Poolstogen() + m.Poolstogen = omitnull.FromNull(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Pupae != nil { + val := o.Pupae() + m.Pupae = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.Total != nil { + val := o.Total() + m.Total = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.Unknown != nil { + val := o.Unknown() + m.Unknown = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Globalzscore != nil { + val := o.Globalzscore() + m.Globalzscore = omitnull.FromNull(val) + } + if o.H3R7 != nil { + val := o.H3R7() + m.H3R7 = omitnull.FromNull(val) + } + if o.H3R8 != nil { + val := o.H3R8() + m.H3R8 = omitnull.FromNull(val) + } + if o.R7score != nil { + val := o.R7score() + m.R7score = omitnull.FromNull(val) + } + if o.R8score != nil { + val := o.R8score() + m.R8score = omitnull.FromNull(val) + } + if o.Yearweek != nil { + val := o.Yearweek() + m.Yearweek = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSSpeciesabundanceSetter +// this does nothing with the relationship templates +func (o FSSpeciesabundanceTemplate) BuildManySetter(number int) []*models.FSSpeciesabundanceSetter { + m := make([]*models.FSSpeciesabundanceSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSSpeciesabundance +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSpeciesabundanceTemplate.Create +func (o FSSpeciesabundanceTemplate) Build() *models.FSSpeciesabundance { + m := &models.FSSpeciesabundance{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Bloodedfem != nil { + m.Bloodedfem = o.Bloodedfem() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Eggs != nil { + m.Eggs = o.Eggs() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Females != nil { + m.Females = o.Females() + } + if o.Gravidfem != nil { + m.Gravidfem = o.Gravidfem() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Larvae != nil { + m.Larvae = o.Larvae() + } + if o.Males != nil { + m.Males = o.Males() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Poolstogen != nil { + m.Poolstogen = o.Poolstogen() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Pupae != nil { + m.Pupae = o.Pupae() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.Total != nil { + m.Total = o.Total() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.Unknown != nil { + m.Unknown = o.Unknown() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Globalzscore != nil { + m.Globalzscore = o.Globalzscore() + } + if o.H3R7 != nil { + m.H3R7 = o.H3R7() + } + if o.H3R8 != nil { + m.H3R8 = o.H3R8() + } + if o.R7score != nil { + m.R7score = o.R7score() + } + if o.R8score != nil { + m.R8score = o.R8score() + } + if o.Yearweek != nil { + m.Yearweek = o.Yearweek() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSSpeciesabundanceSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSSpeciesabundanceTemplate.CreateMany +func (o FSSpeciesabundanceTemplate) BuildMany(number int) models.FSSpeciesabundanceSlice { + m := make(models.FSSpeciesabundanceSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSSpeciesabundance +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsSpeciesabundance and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSSpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSpeciesabundance, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSSpeciesabundance(opt) + + m, err := models.FSSpeciesabundances.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsSpeciesabundance and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSSpeciesabundanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSpeciesabundance { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsSpeciesabundance 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 *FSSpeciesabundanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSpeciesabundance { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsSpeciesabundances and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSSpeciesabundanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSpeciesabundanceSlice, error) { + var err error + m := make(models.FSSpeciesabundanceSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsSpeciesabundances and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSSpeciesabundanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSpeciesabundanceSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsSpeciesabundances 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 FSSpeciesabundanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSpeciesabundanceSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSSpeciesabundance has methods that act as mods for the FSSpeciesabundanceTemplate +var FSSpeciesabundanceMods fsSpeciesabundanceMods + +type fsSpeciesabundanceMods struct{} + +func (m fsSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModSlice{ + FSSpeciesabundanceMods.RandomOrganizationID(f), + FSSpeciesabundanceMods.RandomBloodedfem(f), + FSSpeciesabundanceMods.RandomCreationdate(f), + FSSpeciesabundanceMods.RandomCreator(f), + FSSpeciesabundanceMods.RandomEggs(f), + FSSpeciesabundanceMods.RandomEditdate(f), + FSSpeciesabundanceMods.RandomEditor(f), + FSSpeciesabundanceMods.RandomFemales(f), + FSSpeciesabundanceMods.RandomGravidfem(f), + FSSpeciesabundanceMods.RandomGlobalid(f), + FSSpeciesabundanceMods.RandomLarvae(f), + FSSpeciesabundanceMods.RandomMales(f), + FSSpeciesabundanceMods.RandomObjectid(f), + FSSpeciesabundanceMods.RandomPoolstogen(f), + FSSpeciesabundanceMods.RandomProcessed(f), + FSSpeciesabundanceMods.RandomPupae(f), + FSSpeciesabundanceMods.RandomSpecies(f), + FSSpeciesabundanceMods.RandomTotal(f), + FSSpeciesabundanceMods.RandomTrapdataID(f), + FSSpeciesabundanceMods.RandomUnknown(f), + FSSpeciesabundanceMods.RandomCreatedDate(f), + FSSpeciesabundanceMods.RandomCreatedUser(f), + FSSpeciesabundanceMods.RandomGeometryX(f), + FSSpeciesabundanceMods.RandomGeometryY(f), + FSSpeciesabundanceMods.RandomLastEditedDate(f), + FSSpeciesabundanceMods.RandomLastEditedUser(f), + FSSpeciesabundanceMods.RandomGlobalzscore(f), + FSSpeciesabundanceMods.RandomH3R7(f), + FSSpeciesabundanceMods.RandomH3R8(f), + FSSpeciesabundanceMods.RandomR7score(f), + FSSpeciesabundanceMods.RandomR8score(f), + FSSpeciesabundanceMods.RandomYearweek(f), + FSSpeciesabundanceMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) OrganizationID(val null.Val[int32]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() null.Val[int32]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetOrganizationID() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Bloodedfem(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) BloodedfemFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Bloodedfem = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetBloodedfem() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Bloodedfem = 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 fsSpeciesabundanceMods) RandomBloodedfem(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomBloodedfemNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Creationdate(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) CreationdateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetCreationdate() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creationdate = 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 fsSpeciesabundanceMods) RandomCreationdate(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Creator(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) CreatorFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetCreator() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creator = 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 fsSpeciesabundanceMods) RandomCreator(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Eggs(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) EggsFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Eggs = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetEggs() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Eggs = 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 fsSpeciesabundanceMods) RandomEggs(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomEggsNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Editdate(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) EditdateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetEditdate() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editdate = 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 fsSpeciesabundanceMods) RandomEditdate(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Editor(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) EditorFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetEditor() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editor = 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 fsSpeciesabundanceMods) RandomEditor(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Females(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) FemalesFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Females = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetFemales() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Females = 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 fsSpeciesabundanceMods) RandomFemales(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFemalesNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Gravidfem(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) GravidfemFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Gravidfem = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetGravidfem() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Gravidfem = 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 fsSpeciesabundanceMods) RandomGravidfem(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGravidfemNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Globalid(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) GlobalidFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetGlobalid() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalid = 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 fsSpeciesabundanceMods) RandomGlobalid(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Larvae(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) LarvaeFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Larvae = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetLarvae() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Larvae = 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 fsSpeciesabundanceMods) RandomLarvae(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Males(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) MalesFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Males = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetMales() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Males = 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 fsSpeciesabundanceMods) RandomMales(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomMalesNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Objectid(val int32) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) ObjectidFunc(f func() int32) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetObjectid() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSpeciesabundanceMods) RandomObjectid(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Poolstogen(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) PoolstogenFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Poolstogen = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetPoolstogen() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Poolstogen = 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 fsSpeciesabundanceMods) RandomPoolstogen(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPoolstogenNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Processed(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetProcessed() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Processed = 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 fsSpeciesabundanceMods) RandomProcessed(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Pupae(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) PupaeFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Pupae = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetPupae() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Pupae = 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 fsSpeciesabundanceMods) RandomPupae(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPupaeNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Species(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) SpeciesFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetSpecies() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Species = 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 fsSpeciesabundanceMods) RandomSpecies(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Total(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) TotalFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Total = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetTotal() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Total = 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 fsSpeciesabundanceMods) RandomTotal(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomTotalNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) TrapdataID(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) TrapdataIDFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetTrapdataID() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.TrapdataID = 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 fsSpeciesabundanceMods) RandomTrapdataID(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Unknown(val null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) UnknownFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Unknown = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetUnknown() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Unknown = 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 fsSpeciesabundanceMods) RandomUnknown(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomUnknownNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) CreatedDate(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) CreatedDateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetCreatedDate() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedDate = 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 fsSpeciesabundanceMods) RandomCreatedDate(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) CreatedUser(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) CreatedUserFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetCreatedUser() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedUser = 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 fsSpeciesabundanceMods) RandomCreatedUser(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) GeometryX(val null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) GeometryXFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetGeometryX() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryX = 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 fsSpeciesabundanceMods) RandomGeometryX(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) GeometryY(val null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) GeometryYFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetGeometryY() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryY = 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 fsSpeciesabundanceMods) RandomGeometryY(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) LastEditedDate(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) LastEditedDateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetLastEditedDate() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedDate = 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 fsSpeciesabundanceMods) RandomLastEditedDate(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) LastEditedUser(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) LastEditedUserFunc(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetLastEditedUser() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedUser = 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 fsSpeciesabundanceMods) RandomLastEditedUser(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Globalzscore(val null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) GlobalzscoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalzscore = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetGlobalzscore() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalzscore = 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 fsSpeciesabundanceMods) RandomGlobalzscore(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGlobalzscoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) H3R7(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) H3R7Func(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R7 = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetH3R7() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R7 = 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 fsSpeciesabundanceMods) RandomH3R7(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R7NotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) H3R8(val null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) H3R8Func(f func() null.Val[string]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R8 = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetH3R8() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R8 = 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 fsSpeciesabundanceMods) RandomH3R8(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R8NotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) R7score(val null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) R7scoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R7score = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetR7score() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R7score = 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 fsSpeciesabundanceMods) RandomR7score(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomR7scoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) R8score(val null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) R8scoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R8score = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetR8score() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R8score = 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 fsSpeciesabundanceMods) RandomR8score(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomR8scoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Yearweek(val null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) YearweekFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Yearweek = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetYearweek() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Yearweek = 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 fsSpeciesabundanceMods) RandomYearweek(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomYearweekNotNull(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsSpeciesabundanceMods) Updated(val time.Time) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsSpeciesabundanceMods) UpdatedFunc(f func() time.Time) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsSpeciesabundanceMods) UnsetUpdated() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsSpeciesabundanceMods) RandomUpdated(f *faker.Faker) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsSpeciesabundanceMods) WithParentsCascading() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { + if isDone, _ := fsSpeciesabundanceWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsSpeciesabundanceWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsSpeciesabundanceMods) WithOrganization(rel *OrganizationTemplate) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { + o.r.Organization = &fsSpeciesabundanceROrganizationR{ + o: rel, + } + }) +} + +func (m fsSpeciesabundanceMods) WithNewOrganization(mods ...OrganizationMod) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsSpeciesabundanceMods) WithExistingOrganization(em *models.Organization) FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { + o.r.Organization = &fsSpeciesabundanceROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsSpeciesabundanceMods) WithoutOrganization() FSSpeciesabundanceMod { + return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_stormdrain.bob.go b/factory/fs_stormdrain.bob.go new file mode 100644 index 00000000..983f8456 --- /dev/null +++ b/factory/fs_stormdrain.bob.go @@ -0,0 +1,1670 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSStormdrainMod interface { + Apply(context.Context, *FSStormdrainTemplate) +} + +type FSStormdrainModFunc func(context.Context, *FSStormdrainTemplate) + +func (f FSStormdrainModFunc) Apply(ctx context.Context, n *FSStormdrainTemplate) { + f(ctx, n) +} + +type FSStormdrainModSlice []FSStormdrainMod + +func (mods FSStormdrainModSlice) Apply(ctx context.Context, n *FSStormdrainTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Jurisdiction func() null.Val[string] + Lastaction func() null.Val[string] + Laststatus func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Nexttreatmentdate func() null.Val[int64] + Objectid func() int32 + Symbology func() null.Val[string] + Type func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsStormdrainR + f *Factory + + alreadyPersisted bool +} + +type fsStormdrainR struct { + Organization *fsStormdrainROrganizationR +} + +type fsStormdrainROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSStormdrainTemplate +func (o *FSStormdrainTemplate) Apply(ctx context.Context, mods ...FSStormdrainMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSStormdrain +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSStormdrainSetter +// this does nothing with the relationship templates +func (o FSStormdrainTemplate) BuildSetter() *models.FSStormdrainSetter { + m := &models.FSStormdrainSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Lastaction != nil { + val := o.Lastaction() + m.Lastaction = omitnull.FromNull(val) + } + if o.Laststatus != nil { + val := o.Laststatus() + m.Laststatus = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Nexttreatmentdate != nil { + val := o.Nexttreatmentdate() + m.Nexttreatmentdate = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSStormdrainSetter +// this does nothing with the relationship templates +func (o FSStormdrainTemplate) BuildManySetter(number int) []*models.FSStormdrainSetter { + m := make([]*models.FSStormdrainSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSStormdrain +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSStormdrainTemplate.Create +func (o FSStormdrainTemplate) Build() *models.FSStormdrain { + m := &models.FSStormdrain{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Lastaction != nil { + m.Lastaction = o.Lastaction() + } + if o.Laststatus != nil { + m.Laststatus = o.Laststatus() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Nexttreatmentdate != nil { + m.Nexttreatmentdate = o.Nexttreatmentdate() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Type != nil { + m.Type = o.Type() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSStormdrainSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSStormdrainTemplate.CreateMany +func (o FSStormdrainTemplate) BuildMany(number int) models.FSStormdrainSlice { + m := make(models.FSStormdrainSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSStormdrain +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsStormdrain and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSStormdrain, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSStormdrain(opt) + + m, err := models.FSStormdrains.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsStormdrain and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSStormdrainTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSStormdrain { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsStormdrain 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 *FSStormdrainTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSStormdrain { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsStormdrains and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSStormdrainTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSStormdrainSlice, error) { + var err error + m := make(models.FSStormdrainSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsStormdrains and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSStormdrainTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSStormdrainSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsStormdrains 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 FSStormdrainTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSStormdrainSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSStormdrain has methods that act as mods for the FSStormdrainTemplate +var FSStormdrainMods fsStormdrainMods + +type fsStormdrainMods struct{} + +func (m fsStormdrainMods) RandomizeAllColumns(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModSlice{ + FSStormdrainMods.RandomOrganizationID(f), + FSStormdrainMods.RandomCreationdate(f), + FSStormdrainMods.RandomCreator(f), + FSStormdrainMods.RandomEditdate(f), + FSStormdrainMods.RandomEditor(f), + FSStormdrainMods.RandomGlobalid(f), + FSStormdrainMods.RandomJurisdiction(f), + FSStormdrainMods.RandomLastaction(f), + FSStormdrainMods.RandomLaststatus(f), + FSStormdrainMods.RandomLasttreatdate(f), + FSStormdrainMods.RandomNexttreatmentdate(f), + FSStormdrainMods.RandomObjectid(f), + FSStormdrainMods.RandomSymbology(f), + FSStormdrainMods.RandomType(f), + FSStormdrainMods.RandomZone(f), + FSStormdrainMods.RandomZone2(f), + FSStormdrainMods.RandomCreatedDate(f), + FSStormdrainMods.RandomCreatedUser(f), + FSStormdrainMods.RandomGeometryX(f), + FSStormdrainMods.RandomGeometryY(f), + FSStormdrainMods.RandomLastEditedDate(f), + FSStormdrainMods.RandomLastEditedUser(f), + FSStormdrainMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsStormdrainMods) OrganizationID(val null.Val[int32]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) OrganizationIDFunc(f func() null.Val[int32]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetOrganizationID() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Creationdate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) CreationdateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetCreationdate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creationdate = 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 fsStormdrainMods) RandomCreationdate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Creator(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) CreatorFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetCreator() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creator = 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 fsStormdrainMods) RandomCreator(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Editdate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) EditdateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetEditdate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editdate = 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 fsStormdrainMods) RandomEditdate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Editor(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) EditorFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetEditor() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editor = 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 fsStormdrainMods) RandomEditor(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Globalid(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) GlobalidFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetGlobalid() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Globalid = 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 fsStormdrainMods) RandomGlobalid(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Jurisdiction(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) JurisdictionFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetJurisdiction() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Jurisdiction = 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 fsStormdrainMods) RandomJurisdiction(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Lastaction(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) LastactionFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lastaction = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetLastaction() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lastaction = 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 fsStormdrainMods) RandomLastaction(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastactionNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Laststatus(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) LaststatusFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Laststatus = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetLaststatus() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Laststatus = 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 fsStormdrainMods) RandomLaststatus(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLaststatusNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Lasttreatdate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) LasttreatdateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetLasttreatdate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lasttreatdate = 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 fsStormdrainMods) RandomLasttreatdate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Nexttreatmentdate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) NexttreatmentdateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Nexttreatmentdate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetNexttreatmentdate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Nexttreatmentdate = 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 fsStormdrainMods) RandomNexttreatmentdate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNexttreatmentdateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Objectid(val int32) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) ObjectidFunc(f func() int32) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetObjectid() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsStormdrainMods) RandomObjectid(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Symbology(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) SymbologyFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetSymbology() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Symbology = 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 fsStormdrainMods) RandomSymbology(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Type(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Type = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) TypeFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetType() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Type = 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 fsStormdrainMods) RandomType(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTypeNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Zone(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) ZoneFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetZone() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone = 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 fsStormdrainMods) RandomZone(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Zone2(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) Zone2Func(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetZone2() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone2 = 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 fsStormdrainMods) RandomZone2(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) CreatedDate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) CreatedDateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetCreatedDate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedDate = 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 fsStormdrainMods) RandomCreatedDate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) CreatedUser(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) CreatedUserFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetCreatedUser() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedUser = 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 fsStormdrainMods) RandomCreatedUser(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) GeometryX(val null.Val[float64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) GeometryXFunc(f func() null.Val[float64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetGeometryX() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryX = 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 fsStormdrainMods) RandomGeometryX(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) GeometryY(val null.Val[float64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) GeometryYFunc(f func() null.Val[float64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetGeometryY() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryY = 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 fsStormdrainMods) RandomGeometryY(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) LastEditedDate(val null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) LastEditedDateFunc(f func() null.Val[int64]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetLastEditedDate() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedDate = 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 fsStormdrainMods) RandomLastEditedDate(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) LastEditedUser(val null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) LastEditedUserFunc(f func() null.Val[string]) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetLastEditedUser() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedUser = 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 fsStormdrainMods) RandomLastEditedUser(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsStormdrainMods) Updated(val time.Time) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsStormdrainMods) UpdatedFunc(f func() time.Time) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsStormdrainMods) UnsetUpdated() FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsStormdrainMods) RandomUpdated(f *faker.Faker) FSStormdrainMod { + return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsStormdrainMods) WithParentsCascading() FSStormdrainMod { + return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { + if isDone, _ := fsStormdrainWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsStormdrainWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsStormdrainMods) WithOrganization(rel *OrganizationTemplate) FSStormdrainMod { + return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { + o.r.Organization = &fsStormdrainROrganizationR{ + o: rel, + } + }) +} + +func (m fsStormdrainMods) WithNewOrganization(mods ...OrganizationMod) FSStormdrainMod { + return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsStormdrainMods) WithExistingOrganization(em *models.Organization) FSStormdrainMod { + return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { + o.r.Organization = &fsStormdrainROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsStormdrainMods) WithoutOrganization() FSStormdrainMod { + return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_timecard.bob.go b/factory/fs_timecard.bob.go new file mode 100644 index 00000000..b701a84f --- /dev/null +++ b/factory/fs_timecard.bob.go @@ -0,0 +1,2228 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSTimecardMod interface { + Apply(context.Context, *FSTimecardTemplate) +} + +type FSTimecardModFunc func(context.Context, *FSTimecardTemplate) + +func (f FSTimecardModFunc) Apply(ctx context.Context, n *FSTimecardTemplate) { + f(ctx, n) +} + +type FSTimecardModSlice []FSTimecardMod + +func (mods FSTimecardModSlice) Apply(ctx context.Context, n *FSTimecardTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Equiptype func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Lclocid func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Samplelocid func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Traplocid func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Rodentlocid func() null.Val[string] + Updated func() time.Time + + r fsTimecardR + f *Factory + + alreadyPersisted bool +} + +type fsTimecardR struct { + Organization *fsTimecardROrganizationR +} + +type fsTimecardROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSTimecardTemplate +func (o *FSTimecardTemplate) Apply(ctx context.Context, mods ...FSTimecardMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSTimecard +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSTimecardSetter +// this does nothing with the relationship templates +func (o FSTimecardTemplate) BuildSetter() *models.FSTimecardSetter { + m := &models.FSTimecardSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Equiptype != nil { + val := o.Equiptype() + m.Equiptype = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lclocid != nil { + val := o.Lclocid() + m.Lclocid = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Samplelocid != nil { + val := o.Samplelocid() + m.Samplelocid = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Traplocid != nil { + val := o.Traplocid() + m.Traplocid = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Rodentlocid != nil { + val := o.Rodentlocid() + m.Rodentlocid = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSTimecardSetter +// this does nothing with the relationship templates +func (o FSTimecardTemplate) BuildManySetter(number int) []*models.FSTimecardSetter { + m := make([]*models.FSTimecardSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSTimecard +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTimecardTemplate.Create +func (o FSTimecardTemplate) Build() *models.FSTimecard { + m := &models.FSTimecard{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Equiptype != nil { + m.Equiptype = o.Equiptype() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lclocid != nil { + m.Lclocid = o.Lclocid() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Samplelocid != nil { + m.Samplelocid = o.Samplelocid() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Traplocid != nil { + m.Traplocid = o.Traplocid() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Rodentlocid != nil { + m.Rodentlocid = o.Rodentlocid() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSTimecardSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTimecardTemplate.CreateMany +func (o FSTimecardTemplate) BuildMany(number int) models.FSTimecardSlice { + m := make(models.FSTimecardSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSTimecard(m *models.FSTimecardSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSTimecard +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsTimecard and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTimecard, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSTimecard(opt) + + m, err := models.FSTimecards.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsTimecard and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSTimecardTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTimecard { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsTimecard 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 *FSTimecardTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTimecard { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsTimecards and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSTimecardTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTimecardSlice, error) { + var err error + m := make(models.FSTimecardSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsTimecards and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSTimecardTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTimecardSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsTimecards 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 FSTimecardTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTimecardSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSTimecard has methods that act as mods for the FSTimecardTemplate +var FSTimecardMods fsTimecardMods + +type fsTimecardMods struct{} + +func (m fsTimecardMods) RandomizeAllColumns(f *faker.Faker) FSTimecardMod { + return FSTimecardModSlice{ + FSTimecardMods.RandomOrganizationID(f), + FSTimecardMods.RandomActivity(f), + FSTimecardMods.RandomComments(f), + FSTimecardMods.RandomCreationdate(f), + FSTimecardMods.RandomCreator(f), + FSTimecardMods.RandomEnddatetime(f), + FSTimecardMods.RandomEquiptype(f), + FSTimecardMods.RandomExternalid(f), + FSTimecardMods.RandomEditdate(f), + FSTimecardMods.RandomEditor(f), + FSTimecardMods.RandomFieldtech(f), + FSTimecardMods.RandomGlobalid(f), + FSTimecardMods.RandomLclocid(f), + FSTimecardMods.RandomLinelocid(f), + FSTimecardMods.RandomLocationname(f), + FSTimecardMods.RandomObjectid(f), + FSTimecardMods.RandomPointlocid(f), + FSTimecardMods.RandomPolygonlocid(f), + FSTimecardMods.RandomSamplelocid(f), + FSTimecardMods.RandomSrid(f), + FSTimecardMods.RandomStartdatetime(f), + FSTimecardMods.RandomTraplocid(f), + FSTimecardMods.RandomZone(f), + FSTimecardMods.RandomZone2(f), + FSTimecardMods.RandomCreatedDate(f), + FSTimecardMods.RandomCreatedUser(f), + FSTimecardMods.RandomGeometryX(f), + FSTimecardMods.RandomGeometryY(f), + FSTimecardMods.RandomLastEditedDate(f), + FSTimecardMods.RandomLastEditedUser(f), + FSTimecardMods.RandomRodentlocid(f), + FSTimecardMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsTimecardMods) OrganizationID(val null.Val[int32]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) OrganizationIDFunc(f func() null.Val[int32]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetOrganizationID() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Activity(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) ActivityFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetActivity() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Activity = 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 fsTimecardMods) RandomActivity(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Comments(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) CommentsFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetComments() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Comments = 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 fsTimecardMods) RandomComments(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Creationdate(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) CreationdateFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetCreationdate() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creationdate = 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 fsTimecardMods) RandomCreationdate(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Creator(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) CreatorFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetCreator() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creator = 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 fsTimecardMods) RandomCreator(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Enddatetime(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) EnddatetimeFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetEnddatetime() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Enddatetime = 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 fsTimecardMods) RandomEnddatetime(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Equiptype(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Equiptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) EquiptypeFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Equiptype = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetEquiptype() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Equiptype = 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 fsTimecardMods) RandomEquiptype(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEquiptypeNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Externalid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) ExternalidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetExternalid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Externalid = 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 fsTimecardMods) RandomExternalid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Editdate(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) EditdateFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetEditdate() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editdate = 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 fsTimecardMods) RandomEditdate(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Editor(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) EditorFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetEditor() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editor = 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 fsTimecardMods) RandomEditor(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Fieldtech(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) FieldtechFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetFieldtech() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Fieldtech = 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 fsTimecardMods) RandomFieldtech(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Globalid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) GlobalidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetGlobalid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Globalid = 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 fsTimecardMods) RandomGlobalid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Lclocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Lclocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) LclocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Lclocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetLclocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Lclocid = 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 fsTimecardMods) RandomLclocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Lclocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLclocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Lclocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Linelocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) LinelocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetLinelocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Linelocid = 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 fsTimecardMods) RandomLinelocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Locationname(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) LocationnameFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetLocationname() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Locationname = 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 fsTimecardMods) RandomLocationname(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Objectid(val int32) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) ObjectidFunc(f func() int32) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetObjectid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTimecardMods) RandomObjectid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Pointlocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) PointlocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetPointlocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Pointlocid = 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 fsTimecardMods) RandomPointlocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Polygonlocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) PolygonlocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetPolygonlocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Polygonlocid = 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 fsTimecardMods) RandomPolygonlocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Samplelocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) SamplelocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Samplelocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetSamplelocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Samplelocid = 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 fsTimecardMods) RandomSamplelocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSamplelocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Srid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) SridFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetSrid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Srid = 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 fsTimecardMods) RandomSrid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Startdatetime(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) StartdatetimeFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetStartdatetime() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Startdatetime = 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 fsTimecardMods) RandomStartdatetime(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Traplocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Traplocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) TraplocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Traplocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetTraplocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Traplocid = 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 fsTimecardMods) RandomTraplocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Traplocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTraplocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Traplocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Zone(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) ZoneFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetZone() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone = 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 fsTimecardMods) RandomZone(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Zone2(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) Zone2Func(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetZone2() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone2 = 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 fsTimecardMods) RandomZone2(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) CreatedDate(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) CreatedDateFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetCreatedDate() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedDate = 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 fsTimecardMods) RandomCreatedDate(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) CreatedUser(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) CreatedUserFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetCreatedUser() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedUser = 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 fsTimecardMods) RandomCreatedUser(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) GeometryX(val null.Val[float64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) GeometryXFunc(f func() null.Val[float64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetGeometryX() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryX = 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 fsTimecardMods) RandomGeometryX(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) GeometryY(val null.Val[float64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) GeometryYFunc(f func() null.Val[float64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetGeometryY() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryY = 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 fsTimecardMods) RandomGeometryY(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) LastEditedDate(val null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) LastEditedDateFunc(f func() null.Val[int64]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetLastEditedDate() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedDate = 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 fsTimecardMods) RandomLastEditedDate(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) LastEditedUser(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) LastEditedUserFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetLastEditedUser() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedUser = 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 fsTimecardMods) RandomLastEditedUser(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Rodentlocid(val null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) RodentlocidFunc(f func() null.Val[string]) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Rodentlocid = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetRodentlocid() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Rodentlocid = 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 fsTimecardMods) RandomRodentlocid(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRodentlocidNotNull(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTimecardMods) Updated(val time.Time) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsTimecardMods) UpdatedFunc(f func() time.Time) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsTimecardMods) UnsetUpdated() FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTimecardMods) RandomUpdated(f *faker.Faker) FSTimecardMod { + return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsTimecardMods) WithParentsCascading() FSTimecardMod { + return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { + if isDone, _ := fsTimecardWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsTimecardWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsTimecardMods) WithOrganization(rel *OrganizationTemplate) FSTimecardMod { + return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { + o.r.Organization = &fsTimecardROrganizationR{ + o: rel, + } + }) +} + +func (m fsTimecardMods) WithNewOrganization(mods ...OrganizationMod) FSTimecardMod { + return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsTimecardMods) WithExistingOrganization(em *models.Organization) FSTimecardMod { + return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { + o.r.Organization = &fsTimecardROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsTimecardMods) WithoutOrganization() FSTimecardMod { + return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_trapdata.bob.go b/factory/fs_trapdata.bob.go new file mode 100644 index 00000000..df4c827c --- /dev/null +++ b/factory/fs_trapdata.bob.go @@ -0,0 +1,3096 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSTrapdatumMod interface { + Apply(context.Context, *FSTrapdatumTemplate) +} + +type FSTrapdatumModFunc func(context.Context, *FSTrapdatumTemplate) + +func (f FSTrapdatumModFunc) Apply(ctx context.Context, n *FSTrapdatumTemplate) { + f(ctx, n) +} + +type FSTrapdatumModSlice []FSTrapdatumMod + +func (mods FSTrapdatumModSlice) Apply(ctx context.Context, n *FSTrapdatumTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Avetemp func() null.Val[float64] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Field func() null.Val[int64] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Idbytech func() null.Val[string] + Locationname func() null.Val[string] + LocID func() null.Val[string] + LR func() null.Val[int16] + Objectid func() int32 + Processed func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sitecond func() null.Val[string] + Sortbytech func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Trapactivitytype func() null.Val[string] + Trapcondition func() null.Val[string] + Trapnights func() null.Val[int16] + Traptype func() null.Val[string] + Voltage func() null.Val[float64] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Lure func() null.Val[string] + Vectorsurvtrapdataid func() null.Val[string] + Vectorsurvtraplocationid func() null.Val[string] + Updated func() time.Time + + r fsTrapdatumR + f *Factory + + alreadyPersisted bool +} + +type fsTrapdatumR struct { + Organization *fsTrapdatumROrganizationR +} + +type fsTrapdatumROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSTrapdatumTemplate +func (o *FSTrapdatumTemplate) Apply(ctx context.Context, mods ...FSTrapdatumMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSTrapdatum +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSTrapdatumSetter +// this does nothing with the relationship templates +func (o FSTrapdatumTemplate) BuildSetter() *models.FSTrapdatumSetter { + m := &models.FSTrapdatumSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Field != nil { + val := o.Field() + m.Field = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Idbytech != nil { + val := o.Idbytech() + m.Idbytech = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LocID != nil { + val := o.LocID() + m.LocID = omitnull.FromNull(val) + } + if o.LR != nil { + val := o.LR() + m.LR = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Sortbytech != nil { + val := o.Sortbytech() + m.Sortbytech = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Trapactivitytype != nil { + val := o.Trapactivitytype() + m.Trapactivitytype = omitnull.FromNull(val) + } + if o.Trapcondition != nil { + val := o.Trapcondition() + m.Trapcondition = omitnull.FromNull(val) + } + if o.Trapnights != nil { + val := o.Trapnights() + m.Trapnights = omitnull.FromNull(val) + } + if o.Traptype != nil { + val := o.Traptype() + m.Traptype = omitnull.FromNull(val) + } + if o.Voltage != nil { + val := o.Voltage() + m.Voltage = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Lure != nil { + val := o.Lure() + m.Lure = omitnull.FromNull(val) + } + if o.Vectorsurvtrapdataid != nil { + val := o.Vectorsurvtrapdataid() + m.Vectorsurvtrapdataid = omitnull.FromNull(val) + } + if o.Vectorsurvtraplocationid != nil { + val := o.Vectorsurvtraplocationid() + m.Vectorsurvtraplocationid = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSTrapdatumSetter +// this does nothing with the relationship templates +func (o FSTrapdatumTemplate) BuildManySetter(number int) []*models.FSTrapdatumSetter { + m := make([]*models.FSTrapdatumSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSTrapdatum +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTrapdatumTemplate.Create +func (o FSTrapdatumTemplate) Build() *models.FSTrapdatum { + m := &models.FSTrapdatum{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Field != nil { + m.Field = o.Field() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Idbytech != nil { + m.Idbytech = o.Idbytech() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LocID != nil { + m.LocID = o.LocID() + } + if o.LR != nil { + m.LR = o.LR() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Sortbytech != nil { + m.Sortbytech = o.Sortbytech() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Trapactivitytype != nil { + m.Trapactivitytype = o.Trapactivitytype() + } + if o.Trapcondition != nil { + m.Trapcondition = o.Trapcondition() + } + if o.Trapnights != nil { + m.Trapnights = o.Trapnights() + } + if o.Traptype != nil { + m.Traptype = o.Traptype() + } + if o.Voltage != nil { + m.Voltage = o.Voltage() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Lure != nil { + m.Lure = o.Lure() + } + if o.Vectorsurvtrapdataid != nil { + m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() + } + if o.Vectorsurvtraplocationid != nil { + m.Vectorsurvtraplocationid = o.Vectorsurvtraplocationid() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSTrapdatumSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTrapdatumTemplate.CreateMany +func (o FSTrapdatumTemplate) BuildMany(number int) models.FSTrapdatumSlice { + m := make(models.FSTrapdatumSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSTrapdatum +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsTrapdatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTrapdatum, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSTrapdatum(opt) + + m, err := models.FSTrapdata.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsTrapdatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSTrapdatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTrapdatum { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsTrapdatum 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 *FSTrapdatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTrapdatum { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsTrapdata and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSTrapdatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTrapdatumSlice, error) { + var err error + m := make(models.FSTrapdatumSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsTrapdata and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSTrapdatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTrapdatumSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsTrapdata 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 FSTrapdatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTrapdatumSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSTrapdatum has methods that act as mods for the FSTrapdatumTemplate +var FSTrapdatumMods fsTrapdatumMods + +type fsTrapdatumMods struct{} + +func (m fsTrapdatumMods) RandomizeAllColumns(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModSlice{ + FSTrapdatumMods.RandomOrganizationID(f), + FSTrapdatumMods.RandomAvetemp(f), + FSTrapdatumMods.RandomComments(f), + FSTrapdatumMods.RandomCreationdate(f), + FSTrapdatumMods.RandomCreator(f), + FSTrapdatumMods.RandomEnddatetime(f), + FSTrapdatumMods.RandomEditdate(f), + FSTrapdatumMods.RandomEditor(f), + FSTrapdatumMods.RandomFieldtech(f), + FSTrapdatumMods.RandomField(f), + FSTrapdatumMods.RandomGatewaysync(f), + FSTrapdatumMods.RandomGlobalid(f), + FSTrapdatumMods.RandomIdbytech(f), + FSTrapdatumMods.RandomLocationname(f), + FSTrapdatumMods.RandomLocID(f), + FSTrapdatumMods.RandomLR(f), + FSTrapdatumMods.RandomObjectid(f), + FSTrapdatumMods.RandomProcessed(f), + FSTrapdatumMods.RandomRaingauge(f), + FSTrapdatumMods.RandomRecordstatus(f), + FSTrapdatumMods.RandomReviewed(f), + FSTrapdatumMods.RandomReviewedby(f), + FSTrapdatumMods.RandomRevieweddate(f), + FSTrapdatumMods.RandomSitecond(f), + FSTrapdatumMods.RandomSortbytech(f), + FSTrapdatumMods.RandomSrid(f), + FSTrapdatumMods.RandomStartdatetime(f), + FSTrapdatumMods.RandomTrapactivitytype(f), + FSTrapdatumMods.RandomTrapcondition(f), + FSTrapdatumMods.RandomTrapnights(f), + FSTrapdatumMods.RandomTraptype(f), + FSTrapdatumMods.RandomVoltage(f), + FSTrapdatumMods.RandomWinddir(f), + FSTrapdatumMods.RandomWindspeed(f), + FSTrapdatumMods.RandomZone(f), + FSTrapdatumMods.RandomZone2(f), + FSTrapdatumMods.RandomCreatedDate(f), + FSTrapdatumMods.RandomCreatedUser(f), + FSTrapdatumMods.RandomGeometryX(f), + FSTrapdatumMods.RandomGeometryY(f), + FSTrapdatumMods.RandomLastEditedDate(f), + FSTrapdatumMods.RandomLastEditedUser(f), + FSTrapdatumMods.RandomLure(f), + FSTrapdatumMods.RandomVectorsurvtrapdataid(f), + FSTrapdatumMods.RandomVectorsurvtraplocationid(f), + FSTrapdatumMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsTrapdatumMods) OrganizationID(val null.Val[int32]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) OrganizationIDFunc(f func() null.Val[int32]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetOrganizationID() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Avetemp(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) AvetempFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetAvetemp() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Avetemp = 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 fsTrapdatumMods) RandomAvetemp(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Comments(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) CommentsFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetComments() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Comments = 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 fsTrapdatumMods) RandomComments(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Creationdate(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) CreationdateFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetCreationdate() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creationdate = 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 fsTrapdatumMods) RandomCreationdate(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Creator(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) CreatorFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetCreator() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creator = 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 fsTrapdatumMods) RandomCreator(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Enddatetime(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) EnddatetimeFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetEnddatetime() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Enddatetime = 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 fsTrapdatumMods) RandomEnddatetime(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Editdate(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) EditdateFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetEditdate() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editdate = 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 fsTrapdatumMods) RandomEditdate(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Editor(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) EditorFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetEditor() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editor = 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 fsTrapdatumMods) RandomEditor(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Fieldtech(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) FieldtechFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetFieldtech() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Fieldtech = 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 fsTrapdatumMods) RandomFieldtech(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Field(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Field = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) FieldFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Field = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetField() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Field = 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 fsTrapdatumMods) RandomField(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Field = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFieldNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Field = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Gatewaysync(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) GatewaysyncFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetGatewaysync() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Gatewaysync = 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 fsTrapdatumMods) RandomGatewaysync(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Globalid(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) GlobalidFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetGlobalid() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Globalid = 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 fsTrapdatumMods) RandomGlobalid(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Idbytech(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) IdbytechFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Idbytech = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetIdbytech() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Idbytech = 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 fsTrapdatumMods) RandomIdbytech(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIdbytechNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Locationname(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LocationnameFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLocationname() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Locationname = 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 fsTrapdatumMods) RandomLocationname(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) LocID(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LocID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LocIDFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LocID = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLocID() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LocID = 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 fsTrapdatumMods) RandomLocID(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocIDNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) LR(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LR = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LRFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LR = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLR() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LR = 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 fsTrapdatumMods) RandomLR(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLRNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Objectid(val int32) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) ObjectidFunc(f func() int32) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetObjectid() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTrapdatumMods) RandomObjectid(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Processed(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetProcessed() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Processed = 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 fsTrapdatumMods) RandomProcessed(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Raingauge(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) RaingaugeFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetRaingauge() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Raingauge = 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 fsTrapdatumMods) RandomRaingauge(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Recordstatus(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) RecordstatusFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetRecordstatus() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Recordstatus = 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 fsTrapdatumMods) RandomRecordstatus(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Reviewed(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetReviewed() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewed = 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 fsTrapdatumMods) RandomReviewed(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Reviewedby(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) ReviewedbyFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetReviewedby() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewedby = 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 fsTrapdatumMods) RandomReviewedby(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Revieweddate(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) RevieweddateFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetRevieweddate() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Revieweddate = 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 fsTrapdatumMods) RandomRevieweddate(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Sitecond(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) SitecondFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetSitecond() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sitecond = 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 fsTrapdatumMods) RandomSitecond(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Sortbytech(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) SortbytechFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sortbytech = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetSortbytech() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sortbytech = 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 fsTrapdatumMods) RandomSortbytech(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSortbytechNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Srid(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) SridFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetSrid() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Srid = 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 fsTrapdatumMods) RandomSrid(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Startdatetime(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) StartdatetimeFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetStartdatetime() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Startdatetime = 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 fsTrapdatumMods) RandomStartdatetime(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Trapactivitytype(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapactivitytype = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetTrapactivitytype() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapactivitytype = 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 fsTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapactivitytypeNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Trapcondition(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapcondition = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetTrapcondition() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapcondition = 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 fsTrapdatumMods) RandomTrapcondition(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapconditionNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Trapnights(val null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) TrapnightsFunc(f func() null.Val[int16]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapnights = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetTrapnights() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapnights = 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 fsTrapdatumMods) RandomTrapnights(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTrapnightsNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Traptype(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) TraptypeFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Traptype = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetTraptype() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Traptype = 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 fsTrapdatumMods) RandomTraptype(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTraptypeNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Voltage(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) VoltageFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Voltage = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetVoltage() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Voltage = 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 fsTrapdatumMods) RandomVoltage(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomVoltageNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Winddir(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) WinddirFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetWinddir() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Winddir = 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 fsTrapdatumMods) RandomWinddir(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Windspeed(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) WindspeedFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetWindspeed() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Windspeed = 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 fsTrapdatumMods) RandomWindspeed(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Zone(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) ZoneFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetZone() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone = 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 fsTrapdatumMods) RandomZone(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Zone2(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) Zone2Func(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetZone2() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone2 = 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 fsTrapdatumMods) RandomZone2(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) CreatedDate(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) CreatedDateFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetCreatedDate() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedDate = 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 fsTrapdatumMods) RandomCreatedDate(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) CreatedUser(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) CreatedUserFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetCreatedUser() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedUser = 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 fsTrapdatumMods) RandomCreatedUser(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) GeometryX(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) GeometryXFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetGeometryX() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryX = 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 fsTrapdatumMods) RandomGeometryX(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) GeometryY(val null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) GeometryYFunc(f func() null.Val[float64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetGeometryY() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryY = 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 fsTrapdatumMods) RandomGeometryY(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) LastEditedDate(val null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LastEditedDateFunc(f func() null.Val[int64]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLastEditedDate() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedDate = 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 fsTrapdatumMods) RandomLastEditedDate(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) LastEditedUser(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LastEditedUserFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLastEditedUser() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedUser = 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 fsTrapdatumMods) RandomLastEditedUser(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Lure(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Lure = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) LureFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Lure = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetLure() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Lure = 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 fsTrapdatumMods) RandomLure(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Lure = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLureNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Lure = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Vectorsurvtrapdataid(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtrapdataid = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetVectorsurvtrapdataid() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtrapdataid = 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 fsTrapdatumMods) RandomVectorsurvtrapdataid(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Vectorsurvtraplocationid(val null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) VectorsurvtraplocationidFunc(f func() null.Val[string]) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtraplocationid = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetVectorsurvtraplocationid() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtraplocationid = 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 fsTrapdatumMods) RandomVectorsurvtraplocationid(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtraplocationidNotNull(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTrapdatumMods) Updated(val time.Time) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsTrapdatumMods) UpdatedFunc(f func() time.Time) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsTrapdatumMods) UnsetUpdated() FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTrapdatumMods) RandomUpdated(f *faker.Faker) FSTrapdatumMod { + return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsTrapdatumMods) WithParentsCascading() FSTrapdatumMod { + return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { + if isDone, _ := fsTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsTrapdatumWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsTrapdatumMods) WithOrganization(rel *OrganizationTemplate) FSTrapdatumMod { + return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { + o.r.Organization = &fsTrapdatumROrganizationR{ + o: rel, + } + }) +} + +func (m fsTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) FSTrapdatumMod { + return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsTrapdatumMods) WithExistingOrganization(em *models.Organization) FSTrapdatumMod { + return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { + o.r.Organization = &fsTrapdatumROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsTrapdatumMods) WithoutOrganization() FSTrapdatumMod { + return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_traplocation.bob.go b/factory/fs_traplocation.bob.go new file mode 100644 index 00000000..909c2a66 --- /dev/null +++ b/factory/fs_traplocation.bob.go @@ -0,0 +1,2352 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSTraplocationMod interface { + Apply(context.Context, *FSTraplocationTemplate) +} + +type FSTraplocationModFunc func(context.Context, *FSTraplocationTemplate) + +func (f FSTraplocationModFunc) Apply(ctx context.Context, n *FSTraplocationTemplate) { + f(ctx, n) +} + +type FSTraplocationModSlice []FSTraplocationMod + +func (mods FSTraplocationModSlice) Apply(ctx context.Context, n *FSTraplocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Route func() null.Val[int64] + RouteOrder func() null.Val[int64] + SetDow func() null.Val[int64] + Vectorsurvsiteid func() null.Val[string] + H3R7 func() null.Val[string] + H3R8 func() null.Val[string] + Updated func() time.Time + + r fsTraplocationR + f *Factory + + alreadyPersisted bool +} + +type fsTraplocationR struct { + Organization *fsTraplocationROrganizationR +} + +type fsTraplocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSTraplocationTemplate +func (o *FSTraplocationTemplate) Apply(ctx context.Context, mods ...FSTraplocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSTraplocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSTraplocationSetter +// this does nothing with the relationship templates +func (o FSTraplocationTemplate) BuildSetter() *models.FSTraplocationSetter { + m := &models.FSTraplocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Route != nil { + val := o.Route() + m.Route = omitnull.FromNull(val) + } + if o.RouteOrder != nil { + val := o.RouteOrder() + m.RouteOrder = omitnull.FromNull(val) + } + if o.SetDow != nil { + val := o.SetDow() + m.SetDow = omitnull.FromNull(val) + } + if o.Vectorsurvsiteid != nil { + val := o.Vectorsurvsiteid() + m.Vectorsurvsiteid = omitnull.FromNull(val) + } + if o.H3R7 != nil { + val := o.H3R7() + m.H3R7 = omitnull.FromNull(val) + } + if o.H3R8 != nil { + val := o.H3R8() + m.H3R8 = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSTraplocationSetter +// this does nothing with the relationship templates +func (o FSTraplocationTemplate) BuildManySetter(number int) []*models.FSTraplocationSetter { + m := make([]*models.FSTraplocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSTraplocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTraplocationTemplate.Create +func (o FSTraplocationTemplate) Build() *models.FSTraplocation { + m := &models.FSTraplocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Route != nil { + m.Route = o.Route() + } + if o.RouteOrder != nil { + m.RouteOrder = o.RouteOrder() + } + if o.SetDow != nil { + m.SetDow = o.SetDow() + } + if o.Vectorsurvsiteid != nil { + m.Vectorsurvsiteid = o.Vectorsurvsiteid() + } + if o.H3R7 != nil { + m.H3R7 = o.H3R7() + } + if o.H3R8 != nil { + m.H3R8 = o.H3R8() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSTraplocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTraplocationTemplate.CreateMany +func (o FSTraplocationTemplate) BuildMany(number int) models.FSTraplocationSlice { + m := make(models.FSTraplocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSTraplocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsTraplocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTraplocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSTraplocation(opt) + + m, err := models.FSTraplocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsTraplocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSTraplocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTraplocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsTraplocation 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 *FSTraplocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTraplocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsTraplocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSTraplocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTraplocationSlice, error) { + var err error + m := make(models.FSTraplocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsTraplocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSTraplocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTraplocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsTraplocations 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 FSTraplocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTraplocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSTraplocation has methods that act as mods for the FSTraplocationTemplate +var FSTraplocationMods fsTraplocationMods + +type fsTraplocationMods struct{} + +func (m fsTraplocationMods) RandomizeAllColumns(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModSlice{ + FSTraplocationMods.RandomOrganizationID(f), + FSTraplocationMods.RandomAccessdesc(f), + FSTraplocationMods.RandomActive(f), + FSTraplocationMods.RandomComments(f), + FSTraplocationMods.RandomCreationdate(f), + FSTraplocationMods.RandomCreator(f), + FSTraplocationMods.RandomDescription(f), + FSTraplocationMods.RandomExternalid(f), + FSTraplocationMods.RandomEditdate(f), + FSTraplocationMods.RandomEditor(f), + FSTraplocationMods.RandomGatewaysync(f), + FSTraplocationMods.RandomGlobalid(f), + FSTraplocationMods.RandomHabitat(f), + FSTraplocationMods.RandomLocationnumber(f), + FSTraplocationMods.RandomName(f), + FSTraplocationMods.RandomNextactiondatescheduled(f), + FSTraplocationMods.RandomObjectid(f), + FSTraplocationMods.RandomPriority(f), + FSTraplocationMods.RandomUsetype(f), + FSTraplocationMods.RandomZone(f), + FSTraplocationMods.RandomZone2(f), + FSTraplocationMods.RandomCreatedDate(f), + FSTraplocationMods.RandomCreatedUser(f), + FSTraplocationMods.RandomGeometryX(f), + FSTraplocationMods.RandomGeometryY(f), + FSTraplocationMods.RandomLastEditedDate(f), + FSTraplocationMods.RandomLastEditedUser(f), + FSTraplocationMods.RandomRoute(f), + FSTraplocationMods.RandomRouteOrder(f), + FSTraplocationMods.RandomSetDow(f), + FSTraplocationMods.RandomVectorsurvsiteid(f), + FSTraplocationMods.RandomH3R7(f), + FSTraplocationMods.RandomH3R8(f), + FSTraplocationMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsTraplocationMods) OrganizationID(val null.Val[int32]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetOrganizationID() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Accessdesc(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) AccessdescFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetAccessdesc() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Accessdesc = 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 fsTraplocationMods) RandomAccessdesc(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Active(val null.Val[int16]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) ActiveFunc(f func() null.Val[int16]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetActive() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Active = 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 fsTraplocationMods) RandomActive(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Comments(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) CommentsFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetComments() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Comments = 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 fsTraplocationMods) RandomComments(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Creationdate(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) CreationdateFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetCreationdate() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creationdate = 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 fsTraplocationMods) RandomCreationdate(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Creator(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) CreatorFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetCreator() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creator = 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 fsTraplocationMods) RandomCreator(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Description(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) DescriptionFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetDescription() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Description = 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 fsTraplocationMods) RandomDescription(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Externalid(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) ExternalidFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetExternalid() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Externalid = 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 fsTraplocationMods) RandomExternalid(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Editdate(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) EditdateFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetEditdate() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editdate = 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 fsTraplocationMods) RandomEditdate(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Editor(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) EditorFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetEditor() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editor = 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 fsTraplocationMods) RandomEditor(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Gatewaysync(val null.Val[int16]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) GatewaysyncFunc(f func() null.Val[int16]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetGatewaysync() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Gatewaysync = 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 fsTraplocationMods) RandomGatewaysync(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Globalid(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) GlobalidFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetGlobalid() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Globalid = 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 fsTraplocationMods) RandomGlobalid(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Habitat(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) HabitatFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetHabitat() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Habitat = 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 fsTraplocationMods) RandomHabitat(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Locationnumber(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) LocationnumberFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetLocationnumber() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Locationnumber = 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 fsTraplocationMods) RandomLocationnumber(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Name(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) NameFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetName() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Name = 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 fsTraplocationMods) RandomName(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Nextactiondatescheduled(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetNextactiondatescheduled() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Nextactiondatescheduled = 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 fsTraplocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Objectid(val int32) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) ObjectidFunc(f func() int32) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetObjectid() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTraplocationMods) RandomObjectid(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Priority(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) PriorityFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetPriority() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Priority = 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 fsTraplocationMods) RandomPriority(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Usetype(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) UsetypeFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetUsetype() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Usetype = 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 fsTraplocationMods) RandomUsetype(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Zone(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) ZoneFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetZone() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone = 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 fsTraplocationMods) RandomZone(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Zone2(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) Zone2Func(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetZone2() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone2 = 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 fsTraplocationMods) RandomZone2(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) CreatedDate(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) CreatedDateFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetCreatedDate() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedDate = 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 fsTraplocationMods) RandomCreatedDate(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) CreatedUser(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) CreatedUserFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetCreatedUser() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedUser = 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 fsTraplocationMods) RandomCreatedUser(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) GeometryX(val null.Val[float64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) GeometryXFunc(f func() null.Val[float64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetGeometryX() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryX = 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 fsTraplocationMods) RandomGeometryX(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) GeometryY(val null.Val[float64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) GeometryYFunc(f func() null.Val[float64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetGeometryY() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryY = 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 fsTraplocationMods) RandomGeometryY(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) LastEditedDate(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetLastEditedDate() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedDate = 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 fsTraplocationMods) RandomLastEditedDate(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) LastEditedUser(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) LastEditedUserFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetLastEditedUser() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedUser = 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 fsTraplocationMods) RandomLastEditedUser(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Route(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Route = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) RouteFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Route = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetRoute() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Route = 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 fsTraplocationMods) RandomRoute(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Route = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRouteNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Route = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) RouteOrder(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) RouteOrderFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.RouteOrder = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetRouteOrder() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.RouteOrder = 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 fsTraplocationMods) RandomRouteOrder(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRouteOrderNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) SetDow(val null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) SetDowFunc(f func() null.Val[int64]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.SetDow = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetSetDow() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.SetDow = 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 fsTraplocationMods) RandomSetDow(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSetDowNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Vectorsurvsiteid(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) VectorsurvsiteidFunc(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Vectorsurvsiteid = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetVectorsurvsiteid() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Vectorsurvsiteid = 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 fsTraplocationMods) RandomVectorsurvsiteid(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvsiteidNotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) H3R7(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) H3R7Func(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R7 = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetH3R7() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R7 = 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 fsTraplocationMods) RandomH3R7(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R7NotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) H3R8(val null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) H3R8Func(f func() null.Val[string]) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R8 = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetH3R8() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R8 = 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 fsTraplocationMods) RandomH3R8(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R8NotNull(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTraplocationMods) Updated(val time.Time) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsTraplocationMods) UpdatedFunc(f func() time.Time) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsTraplocationMods) UnsetUpdated() FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTraplocationMods) RandomUpdated(f *faker.Faker) FSTraplocationMod { + return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsTraplocationMods) WithParentsCascading() FSTraplocationMod { + return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { + if isDone, _ := fsTraplocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsTraplocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsTraplocationMods) WithOrganization(rel *OrganizationTemplate) FSTraplocationMod { + return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { + o.r.Organization = &fsTraplocationROrganizationR{ + o: rel, + } + }) +} + +func (m fsTraplocationMods) WithNewOrganization(mods ...OrganizationMod) FSTraplocationMod { + return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsTraplocationMods) WithExistingOrganization(em *models.Organization) FSTraplocationMod { + return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { + o.r.Organization = &fsTraplocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsTraplocationMods) WithoutOrganization() FSTraplocationMod { + return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_treatment.bob.go b/factory/fs_treatment.bob.go new file mode 100644 index 00000000..f3550cee --- /dev/null +++ b/factory/fs_treatment.bob.go @@ -0,0 +1,3840 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSTreatmentMod interface { + Apply(context.Context, *FSTreatmentTemplate) +} + +type FSTreatmentModFunc func(context.Context, *FSTreatmentTemplate) + +func (f FSTreatmentModFunc) Apply(ctx context.Context, n *FSTreatmentTemplate) { + f(ctx, n) +} + +type FSTreatmentModSlice []FSTreatmentMod + +func (mods FSTreatmentModSlice) Apply(ctx context.Context, n *FSTreatmentTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Areaunit func() null.Val[string] + Avetemp func() null.Val[float64] + Barrierrouteid func() null.Val[string] + Cbcount func() null.Val[int16] + Comments func() null.Val[string] + Containercount func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Equiptype func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Flowrate func() null.Val[float64] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + InspID func() null.Val[string] + Invloc func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Method func() null.Val[string] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Product func() null.Val[string] + Ptaid func() null.Val[string] + Qty func() null.Val[float64] + Qtyunit func() null.Val[string] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sdid func() null.Val[string] + Sitecond func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Targetspecies func() null.Val[string] + Tirecount func() null.Val[int16] + Treatacres func() null.Val[float64] + Treatarea func() null.Val[float64] + Treathectares func() null.Val[float64] + Treatmenthours func() null.Val[float64] + Treatmentlength func() null.Val[float64] + Treatmentlengthunits func() null.Val[string] + Totalcostprodcut func() null.Val[float64] + Ulvrouteid func() null.Val[string] + Warningoverride func() null.Val[int16] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + TempSitecond func() null.Val[string] + Updated func() time.Time + + r fsTreatmentR + f *Factory + + alreadyPersisted bool +} + +type fsTreatmentR struct { + Organization *fsTreatmentROrganizationR +} + +type fsTreatmentROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSTreatmentTemplate +func (o *FSTreatmentTemplate) Apply(ctx context.Context, mods ...FSTreatmentMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSTreatment +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSTreatmentSetter +// this does nothing with the relationship templates +func (o FSTreatmentTemplate) BuildSetter() *models.FSTreatmentSetter { + m := &models.FSTreatmentSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Areaunit != nil { + val := o.Areaunit() + m.Areaunit = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Barrierrouteid != nil { + val := o.Barrierrouteid() + m.Barrierrouteid = omitnull.FromNull(val) + } + if o.Cbcount != nil { + val := o.Cbcount() + m.Cbcount = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Containercount != nil { + val := o.Containercount() + m.Containercount = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Equiptype != nil { + val := o.Equiptype() + m.Equiptype = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Flowrate != nil { + val := o.Flowrate() + m.Flowrate = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.InspID != nil { + val := o.InspID() + m.InspID = omitnull.FromNull(val) + } + if o.Invloc != nil { + val := o.Invloc() + m.Invloc = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Method != nil { + val := o.Method() + m.Method = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Product != nil { + val := o.Product() + m.Product = omitnull.FromNull(val) + } + if o.Ptaid != nil { + val := o.Ptaid() + m.Ptaid = omitnull.FromNull(val) + } + if o.Qty != nil { + val := o.Qty() + m.Qty = omitnull.FromNull(val) + } + if o.Qtyunit != nil { + val := o.Qtyunit() + m.Qtyunit = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sdid != nil { + val := o.Sdid() + m.Sdid = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Targetspecies != nil { + val := o.Targetspecies() + m.Targetspecies = omitnull.FromNull(val) + } + if o.Tirecount != nil { + val := o.Tirecount() + m.Tirecount = omitnull.FromNull(val) + } + if o.Treatacres != nil { + val := o.Treatacres() + m.Treatacres = omitnull.FromNull(val) + } + if o.Treatarea != nil { + val := o.Treatarea() + m.Treatarea = omitnull.FromNull(val) + } + if o.Treathectares != nil { + val := o.Treathectares() + m.Treathectares = omitnull.FromNull(val) + } + if o.Treatmenthours != nil { + val := o.Treatmenthours() + m.Treatmenthours = omitnull.FromNull(val) + } + if o.Treatmentlength != nil { + val := o.Treatmentlength() + m.Treatmentlength = omitnull.FromNull(val) + } + if o.Treatmentlengthunits != nil { + val := o.Treatmentlengthunits() + m.Treatmentlengthunits = omitnull.FromNull(val) + } + if o.Totalcostprodcut != nil { + val := o.Totalcostprodcut() + m.Totalcostprodcut = omitnull.FromNull(val) + } + if o.Ulvrouteid != nil { + val := o.Ulvrouteid() + m.Ulvrouteid = omitnull.FromNull(val) + } + if o.Warningoverride != nil { + val := o.Warningoverride() + m.Warningoverride = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.TempSitecond != nil { + val := o.TempSitecond() + m.TempSitecond = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSTreatmentSetter +// this does nothing with the relationship templates +func (o FSTreatmentTemplate) BuildManySetter(number int) []*models.FSTreatmentSetter { + m := make([]*models.FSTreatmentSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSTreatment +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTreatmentTemplate.Create +func (o FSTreatmentTemplate) Build() *models.FSTreatment { + m := &models.FSTreatment{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Areaunit != nil { + m.Areaunit = o.Areaunit() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Barrierrouteid != nil { + m.Barrierrouteid = o.Barrierrouteid() + } + if o.Cbcount != nil { + m.Cbcount = o.Cbcount() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Containercount != nil { + m.Containercount = o.Containercount() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Equiptype != nil { + m.Equiptype = o.Equiptype() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Flowrate != nil { + m.Flowrate = o.Flowrate() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.InspID != nil { + m.InspID = o.InspID() + } + if o.Invloc != nil { + m.Invloc = o.Invloc() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Method != nil { + m.Method = o.Method() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Product != nil { + m.Product = o.Product() + } + if o.Ptaid != nil { + m.Ptaid = o.Ptaid() + } + if o.Qty != nil { + m.Qty = o.Qty() + } + if o.Qtyunit != nil { + m.Qtyunit = o.Qtyunit() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sdid != nil { + m.Sdid = o.Sdid() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Targetspecies != nil { + m.Targetspecies = o.Targetspecies() + } + if o.Tirecount != nil { + m.Tirecount = o.Tirecount() + } + if o.Treatacres != nil { + m.Treatacres = o.Treatacres() + } + if o.Treatarea != nil { + m.Treatarea = o.Treatarea() + } + if o.Treathectares != nil { + m.Treathectares = o.Treathectares() + } + if o.Treatmenthours != nil { + m.Treatmenthours = o.Treatmenthours() + } + if o.Treatmentlength != nil { + m.Treatmentlength = o.Treatmentlength() + } + if o.Treatmentlengthunits != nil { + m.Treatmentlengthunits = o.Treatmentlengthunits() + } + if o.Totalcostprodcut != nil { + m.Totalcostprodcut = o.Totalcostprodcut() + } + if o.Ulvrouteid != nil { + m.Ulvrouteid = o.Ulvrouteid() + } + if o.Warningoverride != nil { + m.Warningoverride = o.Warningoverride() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.TempSitecond != nil { + m.TempSitecond = o.TempSitecond() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSTreatmentSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTreatmentTemplate.CreateMany +func (o FSTreatmentTemplate) BuildMany(number int) models.FSTreatmentSlice { + m := make(models.FSTreatmentSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSTreatment +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsTreatment and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTreatment, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSTreatment(opt) + + m, err := models.FSTreatments.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsTreatment and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSTreatmentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTreatment { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsTreatment 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 *FSTreatmentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTreatment { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsTreatments and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSTreatmentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTreatmentSlice, error) { + var err error + m := make(models.FSTreatmentSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsTreatments and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSTreatmentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTreatmentSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsTreatments 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 FSTreatmentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTreatmentSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSTreatment has methods that act as mods for the FSTreatmentTemplate +var FSTreatmentMods fsTreatmentMods + +type fsTreatmentMods struct{} + +func (m fsTreatmentMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModSlice{ + FSTreatmentMods.RandomOrganizationID(f), + FSTreatmentMods.RandomActivity(f), + FSTreatmentMods.RandomAreaunit(f), + FSTreatmentMods.RandomAvetemp(f), + FSTreatmentMods.RandomBarrierrouteid(f), + FSTreatmentMods.RandomCbcount(f), + FSTreatmentMods.RandomComments(f), + FSTreatmentMods.RandomContainercount(f), + FSTreatmentMods.RandomCreationdate(f), + FSTreatmentMods.RandomCreator(f), + FSTreatmentMods.RandomEnddatetime(f), + FSTreatmentMods.RandomEquiptype(f), + FSTreatmentMods.RandomEditdate(f), + FSTreatmentMods.RandomEditor(f), + FSTreatmentMods.RandomFieldtech(f), + FSTreatmentMods.RandomFlowrate(f), + FSTreatmentMods.RandomGlobalid(f), + FSTreatmentMods.RandomHabitat(f), + FSTreatmentMods.RandomInspID(f), + FSTreatmentMods.RandomInvloc(f), + FSTreatmentMods.RandomLinelocid(f), + FSTreatmentMods.RandomLocationname(f), + FSTreatmentMods.RandomMethod(f), + FSTreatmentMods.RandomObjectid(f), + FSTreatmentMods.RandomPointlocid(f), + FSTreatmentMods.RandomPolygonlocid(f), + FSTreatmentMods.RandomProduct(f), + FSTreatmentMods.RandomPtaid(f), + FSTreatmentMods.RandomQty(f), + FSTreatmentMods.RandomQtyunit(f), + FSTreatmentMods.RandomRaingauge(f), + FSTreatmentMods.RandomRecordstatus(f), + FSTreatmentMods.RandomReviewed(f), + FSTreatmentMods.RandomReviewedby(f), + FSTreatmentMods.RandomRevieweddate(f), + FSTreatmentMods.RandomSdid(f), + FSTreatmentMods.RandomSitecond(f), + FSTreatmentMods.RandomSrid(f), + FSTreatmentMods.RandomStartdatetime(f), + FSTreatmentMods.RandomTargetspecies(f), + FSTreatmentMods.RandomTirecount(f), + FSTreatmentMods.RandomTreatacres(f), + FSTreatmentMods.RandomTreatarea(f), + FSTreatmentMods.RandomTreathectares(f), + FSTreatmentMods.RandomTreatmenthours(f), + FSTreatmentMods.RandomTreatmentlength(f), + FSTreatmentMods.RandomTreatmentlengthunits(f), + FSTreatmentMods.RandomTotalcostprodcut(f), + FSTreatmentMods.RandomUlvrouteid(f), + FSTreatmentMods.RandomWarningoverride(f), + FSTreatmentMods.RandomWinddir(f), + FSTreatmentMods.RandomWindspeed(f), + FSTreatmentMods.RandomZone(f), + FSTreatmentMods.RandomZone2(f), + FSTreatmentMods.RandomGeometryX(f), + FSTreatmentMods.RandomGeometryY(f), + FSTreatmentMods.RandomTempSitecond(f), + FSTreatmentMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsTreatmentMods) OrganizationID(val null.Val[int32]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetOrganizationID() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Activity(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ActivityFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetActivity() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Activity = 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 fsTreatmentMods) RandomActivity(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Areaunit(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) AreaunitFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Areaunit = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetAreaunit() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Areaunit = 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 fsTreatmentMods) RandomAreaunit(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAreaunitNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Avetemp(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) AvetempFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetAvetemp() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Avetemp = 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 fsTreatmentMods) RandomAvetemp(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Barrierrouteid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) BarrierrouteidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Barrierrouteid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetBarrierrouteid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Barrierrouteid = 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 fsTreatmentMods) RandomBarrierrouteid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBarrierrouteidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Cbcount(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) CbcountFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Cbcount = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetCbcount() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Cbcount = 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 fsTreatmentMods) RandomCbcount(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Comments(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) CommentsFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetComments() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Comments = 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 fsTreatmentMods) RandomComments(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Containercount(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ContainercountFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Containercount = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetContainercount() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Containercount = 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 fsTreatmentMods) RandomContainercount(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Creationdate(val null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) CreationdateFunc(f func() null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetCreationdate() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creationdate = 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 fsTreatmentMods) RandomCreationdate(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Creator(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) CreatorFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetCreator() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creator = 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 fsTreatmentMods) RandomCreator(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Enddatetime(val null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) EnddatetimeFunc(f func() null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetEnddatetime() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Enddatetime = 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 fsTreatmentMods) RandomEnddatetime(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Equiptype(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) EquiptypeFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Equiptype = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetEquiptype() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Equiptype = 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 fsTreatmentMods) RandomEquiptype(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEquiptypeNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Editdate(val null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) EditdateFunc(f func() null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetEditdate() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editdate = 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 fsTreatmentMods) RandomEditdate(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Editor(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) EditorFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetEditor() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editor = 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 fsTreatmentMods) RandomEditor(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Fieldtech(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) FieldtechFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetFieldtech() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Fieldtech = 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 fsTreatmentMods) RandomFieldtech(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Flowrate(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) FlowrateFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Flowrate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetFlowrate() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Flowrate = 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 fsTreatmentMods) RandomFlowrate(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomFlowrateNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Globalid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) GlobalidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetGlobalid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Globalid = 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 fsTreatmentMods) RandomGlobalid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Habitat(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) HabitatFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetHabitat() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Habitat = 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 fsTreatmentMods) RandomHabitat(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) InspID(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.InspID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) InspIDFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.InspID = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetInspID() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.InspID = 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 fsTreatmentMods) RandomInspID(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspIDNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Invloc(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Invloc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) InvlocFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Invloc = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetInvloc() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Invloc = 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 fsTreatmentMods) RandomInvloc(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Invloc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInvlocNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Invloc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Linelocid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) LinelocidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetLinelocid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Linelocid = 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 fsTreatmentMods) RandomLinelocid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Locationname(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) LocationnameFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetLocationname() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Locationname = 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 fsTreatmentMods) RandomLocationname(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Method(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Method = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) MethodFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Method = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetMethod() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Method = 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 fsTreatmentMods) RandomMethod(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMethodNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Objectid(val int32) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ObjectidFunc(f func() int32) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetObjectid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTreatmentMods) RandomObjectid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Pointlocid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) PointlocidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetPointlocid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Pointlocid = 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 fsTreatmentMods) RandomPointlocid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Polygonlocid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) PolygonlocidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetPolygonlocid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Polygonlocid = 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 fsTreatmentMods) RandomPolygonlocid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Product(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Product = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ProductFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Product = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetProduct() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Product = 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 fsTreatmentMods) RandomProduct(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Product = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomProductNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Product = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Ptaid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) PtaidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ptaid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetPtaid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ptaid = 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 fsTreatmentMods) RandomPtaid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPtaidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Qty(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) QtyFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qty = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetQty() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qty = 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 fsTreatmentMods) RandomQty(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomQtyNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Qtyunit(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) QtyunitFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qtyunit = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetQtyunit() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qtyunit = 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 fsTreatmentMods) RandomQtyunit(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomQtyunitNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Raingauge(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) RaingaugeFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetRaingauge() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Raingauge = 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 fsTreatmentMods) RandomRaingauge(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Recordstatus(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) RecordstatusFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetRecordstatus() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Recordstatus = 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 fsTreatmentMods) RandomRecordstatus(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Reviewed(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ReviewedFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetReviewed() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewed = 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 fsTreatmentMods) RandomReviewed(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Reviewedby(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ReviewedbyFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetReviewedby() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewedby = 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 fsTreatmentMods) RandomReviewedby(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Revieweddate(val null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) RevieweddateFunc(f func() null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetRevieweddate() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Revieweddate = 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 fsTreatmentMods) RandomRevieweddate(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Sdid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sdid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) SdidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sdid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetSdid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sdid = 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 fsTreatmentMods) RandomSdid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSdidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Sitecond(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) SitecondFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetSitecond() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sitecond = 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 fsTreatmentMods) RandomSitecond(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Srid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) SridFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetSrid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Srid = 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 fsTreatmentMods) RandomSrid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Startdatetime(val null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) StartdatetimeFunc(f func() null.Val[int64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetStartdatetime() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Startdatetime = 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 fsTreatmentMods) RandomStartdatetime(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Targetspecies(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TargetspeciesFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Targetspecies = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTargetspecies() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Targetspecies = 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 fsTreatmentMods) RandomTargetspecies(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetspeciesNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Tirecount(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TirecountFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Tirecount = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTirecount() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Tirecount = 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 fsTreatmentMods) RandomTirecount(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treatacres(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreatacresFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatacres = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreatacres() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatacres = 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 fsTreatmentMods) RandomTreatacres(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatacresNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treatarea(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreatareaFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatarea = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreatarea() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatarea = 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 fsTreatmentMods) RandomTreatarea(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatareaNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treathectares(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreathectaresFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treathectares = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreathectares() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treathectares = 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 fsTreatmentMods) RandomTreathectares(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreathectaresNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treatmenthours(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreatmenthoursFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmenthours = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreatmenthours() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmenthours = 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 fsTreatmentMods) RandomTreatmenthours(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatmenthoursNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treatmentlength(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreatmentlengthFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlength = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreatmentlength() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlength = 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 fsTreatmentMods) RandomTreatmentlength(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatmentlengthNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Treatmentlengthunits(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TreatmentlengthunitsFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlengthunits = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTreatmentlengthunits() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlengthunits = 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 fsTreatmentMods) RandomTreatmentlengthunits(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatmentlengthunitsNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Totalcostprodcut(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TotalcostprodcutFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Totalcostprodcut = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTotalcostprodcut() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Totalcostprodcut = 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 fsTreatmentMods) RandomTotalcostprodcut(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTotalcostprodcutNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Ulvrouteid(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) UlvrouteidFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ulvrouteid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetUlvrouteid() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ulvrouteid = 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 fsTreatmentMods) RandomUlvrouteid(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUlvrouteidNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Warningoverride(val null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Warningoverride = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetWarningoverride() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Warningoverride = 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 fsTreatmentMods) RandomWarningoverride(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWarningoverrideNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Winddir(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) WinddirFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetWinddir() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Winddir = 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 fsTreatmentMods) RandomWinddir(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Windspeed(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) WindspeedFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetWindspeed() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Windspeed = 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 fsTreatmentMods) RandomWindspeed(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Zone(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) ZoneFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetZone() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone = 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 fsTreatmentMods) RandomZone(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Zone2(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) Zone2Func(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetZone2() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone2 = 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 fsTreatmentMods) RandomZone2(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) GeometryX(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) GeometryXFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetGeometryX() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryX = 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 fsTreatmentMods) RandomGeometryX(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) GeometryY(val null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) GeometryYFunc(f func() null.Val[float64]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetGeometryY() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryY = 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 fsTreatmentMods) RandomGeometryY(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) TempSitecond(val null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) TempSitecondFunc(f func() null.Val[string]) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.TempSitecond = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetTempSitecond() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.TempSitecond = 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 fsTreatmentMods) RandomTempSitecond(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTempSitecondNotNull(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentMods) Updated(val time.Time) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentMods) UpdatedFunc(f func() time.Time) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsTreatmentMods) UnsetUpdated() FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTreatmentMods) RandomUpdated(f *faker.Faker) FSTreatmentMod { + return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsTreatmentMods) WithParentsCascading() FSTreatmentMod { + return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { + if isDone, _ := fsTreatmentWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsTreatmentWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsTreatmentMods) WithOrganization(rel *OrganizationTemplate) FSTreatmentMod { + return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { + o.r.Organization = &fsTreatmentROrganizationR{ + o: rel, + } + }) +} + +func (m fsTreatmentMods) WithNewOrganization(mods ...OrganizationMod) FSTreatmentMod { + return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsTreatmentMods) WithExistingOrganization(em *models.Organization) FSTreatmentMod { + return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { + o.r.Organization = &fsTreatmentROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsTreatmentMods) WithoutOrganization() FSTreatmentMod { + return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_treatmentarea.bob.go b/factory/fs_treatmentarea.bob.go new file mode 100644 index 00000000..8fac25a9 --- /dev/null +++ b/factory/fs_treatmentarea.bob.go @@ -0,0 +1,1608 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSTreatmentareaMod interface { + Apply(context.Context, *FSTreatmentareaTemplate) +} + +type FSTreatmentareaModFunc func(context.Context, *FSTreatmentareaTemplate) + +func (f FSTreatmentareaModFunc) Apply(ctx context.Context, n *FSTreatmentareaTemplate) { + f(ctx, n) +} + +type FSTreatmentareaModSlice []FSTreatmentareaMod + +func (mods FSTreatmentareaModSlice) Apply(ctx context.Context, n *FSTreatmentareaTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Notified func() null.Val[int16] + Objectid func() int32 + SessionID func() null.Val[string] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Treatdate func() null.Val[int64] + TreatID func() null.Val[string] + Type func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsTreatmentareaR + f *Factory + + alreadyPersisted bool +} + +type fsTreatmentareaR struct { + Organization *fsTreatmentareaROrganizationR +} + +type fsTreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSTreatmentareaTemplate +func (o *FSTreatmentareaTemplate) Apply(ctx context.Context, mods ...FSTreatmentareaMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSTreatmentarea +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSTreatmentareaSetter +// this does nothing with the relationship templates +func (o FSTreatmentareaTemplate) BuildSetter() *models.FSTreatmentareaSetter { + m := &models.FSTreatmentareaSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Notified != nil { + val := o.Notified() + m.Notified = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.SessionID != nil { + val := o.SessionID() + m.SessionID = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Treatdate != nil { + val := o.Treatdate() + m.Treatdate = omitnull.FromNull(val) + } + if o.TreatID != nil { + val := o.TreatID() + m.TreatID = omitnull.FromNull(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSTreatmentareaSetter +// this does nothing with the relationship templates +func (o FSTreatmentareaTemplate) BuildManySetter(number int) []*models.FSTreatmentareaSetter { + m := make([]*models.FSTreatmentareaSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSTreatmentarea +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTreatmentareaTemplate.Create +func (o FSTreatmentareaTemplate) Build() *models.FSTreatmentarea { + m := &models.FSTreatmentarea{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Notified != nil { + m.Notified = o.Notified() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.SessionID != nil { + m.SessionID = o.SessionID() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Treatdate != nil { + m.Treatdate = o.Treatdate() + } + if o.TreatID != nil { + m.TreatID = o.TreatID() + } + if o.Type != nil { + m.Type = o.Type() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSTreatmentareaSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSTreatmentareaTemplate.CreateMany +func (o FSTreatmentareaTemplate) BuildMany(number int) models.FSTreatmentareaSlice { + m := make(models.FSTreatmentareaSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSTreatmentarea +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsTreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTreatmentarea, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSTreatmentarea(opt) + + m, err := models.FSTreatmentareas.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsTreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSTreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTreatmentarea { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsTreatmentarea 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 *FSTreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTreatmentarea { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsTreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSTreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTreatmentareaSlice, error) { + var err error + m := make(models.FSTreatmentareaSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsTreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSTreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTreatmentareaSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsTreatmentareas 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 FSTreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTreatmentareaSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSTreatmentarea has methods that act as mods for the FSTreatmentareaTemplate +var FSTreatmentareaMods fsTreatmentareaMods + +type fsTreatmentareaMods struct{} + +func (m fsTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModSlice{ + FSTreatmentareaMods.RandomOrganizationID(f), + FSTreatmentareaMods.RandomComments(f), + FSTreatmentareaMods.RandomCreationdate(f), + FSTreatmentareaMods.RandomCreator(f), + FSTreatmentareaMods.RandomEditdate(f), + FSTreatmentareaMods.RandomEditor(f), + FSTreatmentareaMods.RandomGlobalid(f), + FSTreatmentareaMods.RandomNotified(f), + FSTreatmentareaMods.RandomObjectid(f), + FSTreatmentareaMods.RandomSessionID(f), + FSTreatmentareaMods.RandomShapeArea(f), + FSTreatmentareaMods.RandomShapeLength(f), + FSTreatmentareaMods.RandomTreatdate(f), + FSTreatmentareaMods.RandomTreatID(f), + FSTreatmentareaMods.RandomType(f), + FSTreatmentareaMods.RandomCreatedDate(f), + FSTreatmentareaMods.RandomCreatedUser(f), + FSTreatmentareaMods.RandomGeometryX(f), + FSTreatmentareaMods.RandomGeometryY(f), + FSTreatmentareaMods.RandomLastEditedDate(f), + FSTreatmentareaMods.RandomLastEditedUser(f), + FSTreatmentareaMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) OrganizationID(val null.Val[int32]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetOrganizationID() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Comments(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) CommentsFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetComments() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Comments = 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 fsTreatmentareaMods) RandomComments(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Creationdate(val null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetCreationdate() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creationdate = 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 fsTreatmentareaMods) RandomCreationdate(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Creator(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) CreatorFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetCreator() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creator = 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 fsTreatmentareaMods) RandomCreator(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Editdate(val null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) EditdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetEditdate() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editdate = 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 fsTreatmentareaMods) RandomEditdate(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Editor(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) EditorFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetEditor() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editor = 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 fsTreatmentareaMods) RandomEditor(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Globalid(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) GlobalidFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetGlobalid() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Globalid = 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 fsTreatmentareaMods) RandomGlobalid(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Notified(val null.Val[int16]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) NotifiedFunc(f func() null.Val[int16]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Notified = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetNotified() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Notified = 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 fsTreatmentareaMods) RandomNotified(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Objectid(val int32) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) ObjectidFunc(f func() int32) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetObjectid() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTreatmentareaMods) RandomObjectid(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) SessionID(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) SessionIDFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.SessionID = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetSessionID() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.SessionID = 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 fsTreatmentareaMods) RandomSessionID(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSessionIDNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) ShapeArea(val null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetShapeArea() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeArea = 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 fsTreatmentareaMods) RandomShapeArea(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) ShapeLength(val null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetShapeLength() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeLength = 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 fsTreatmentareaMods) RandomShapeLength(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Treatdate(val null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) TreatdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Treatdate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetTreatdate() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Treatdate = 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 fsTreatmentareaMods) RandomTreatdate(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomTreatdateNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) TreatID(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) TreatIDFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.TreatID = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetTreatID() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.TreatID = 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 fsTreatmentareaMods) RandomTreatID(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatIDNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Type(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Type = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) TypeFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetType() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Type = 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 fsTreatmentareaMods) RandomType(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTypeNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) CreatedDate(val null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) CreatedDateFunc(f func() null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetCreatedDate() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedDate = 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 fsTreatmentareaMods) RandomCreatedDate(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) CreatedUser(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) CreatedUserFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetCreatedUser() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedUser = 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 fsTreatmentareaMods) RandomCreatedUser(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) GeometryX(val null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetGeometryX() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryX = 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 fsTreatmentareaMods) RandomGeometryX(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) GeometryY(val null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetGeometryY() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryY = 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 fsTreatmentareaMods) RandomGeometryY(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) LastEditedDate(val null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) LastEditedDateFunc(f func() null.Val[int64]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetLastEditedDate() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedDate = 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 fsTreatmentareaMods) RandomLastEditedDate(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) LastEditedUser(val null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) LastEditedUserFunc(f func() null.Val[string]) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetLastEditedUser() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedUser = 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 fsTreatmentareaMods) RandomLastEditedUser(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsTreatmentareaMods) Updated(val time.Time) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsTreatmentareaMods) UpdatedFunc(f func() time.Time) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsTreatmentareaMods) UnsetUpdated() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsTreatmentareaMods) RandomUpdated(f *faker.Faker) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsTreatmentareaMods) WithParentsCascading() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { + if isDone, _ := fsTreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsTreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsTreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { + o.r.Organization = &fsTreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m fsTreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsTreatmentareaMods) WithExistingOrganization(em *models.Organization) FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { + o.r.Organization = &fsTreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsTreatmentareaMods) WithoutOrganization() FSTreatmentareaMod { + return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_zones.bob.go b/factory/fs_zones.bob.go new file mode 100644 index 00000000..5d8fabd1 --- /dev/null +++ b/factory/fs_zones.bob.go @@ -0,0 +1,1360 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSZoneMod interface { + Apply(context.Context, *FSZoneTemplate) +} + +type FSZoneModFunc func(context.Context, *FSZoneTemplate) + +func (f FSZoneModFunc) Apply(ctx context.Context, n *FSZoneTemplate) { + f(ctx, n) +} + +type FSZoneModSlice []FSZoneMod + +func (mods FSZoneModSlice) Apply(ctx context.Context, n *FSZoneTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Active func() null.Val[int64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsZoneR + f *Factory + + alreadyPersisted bool +} + +type fsZoneR struct { + Organization *fsZoneROrganizationR +} + +type fsZoneROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSZoneTemplate +func (o *FSZoneTemplate) Apply(ctx context.Context, mods ...FSZoneMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSZone +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSZoneSetter +// this does nothing with the relationship templates +func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter { + m := &models.FSZoneSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSZoneSetter +// this does nothing with the relationship templates +func (o FSZoneTemplate) BuildManySetter(number int) []*models.FSZoneSetter { + m := make([]*models.FSZoneSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSZone +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.Create +func (o FSZoneTemplate) Build() *models.FSZone { + m := &models.FSZone{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSZoneSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.CreateMany +func (o FSZoneTemplate) BuildMany(number int) models.FSZoneSlice { + m := make(models.FSZoneSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSZone(m *models.FSZoneSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSZone +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsZone and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSZone, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSZone(opt) + + m, err := models.FSZones.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsZone and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSZone { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsZone 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 *FSZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSZone { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsZones and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSZoneSlice, error) { + var err error + m := make(models.FSZoneSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsZones and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSZoneSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsZones 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 FSZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSZoneSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSZone has methods that act as mods for the FSZoneTemplate +var FSZoneMods fsZoneMods + +type fsZoneMods struct{} + +func (m fsZoneMods) RandomizeAllColumns(f *faker.Faker) FSZoneMod { + return FSZoneModSlice{ + FSZoneMods.RandomOrganizationID(f), + FSZoneMods.RandomActive(f), + FSZoneMods.RandomCreationdate(f), + FSZoneMods.RandomCreator(f), + FSZoneMods.RandomEditdate(f), + FSZoneMods.RandomEditor(f), + FSZoneMods.RandomGlobalid(f), + FSZoneMods.RandomName(f), + FSZoneMods.RandomObjectid(f), + FSZoneMods.RandomShapeArea(f), + FSZoneMods.RandomShapeLength(f), + FSZoneMods.RandomCreatedDate(f), + FSZoneMods.RandomCreatedUser(f), + FSZoneMods.RandomGeometryX(f), + FSZoneMods.RandomGeometryY(f), + FSZoneMods.RandomLastEditedDate(f), + FSZoneMods.RandomLastEditedUser(f), + FSZoneMods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsZoneMods) OrganizationID(val null.Val[int32]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) OrganizationIDFunc(f func() null.Val[int32]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetOrganizationID() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Active(val null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Active = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) ActiveFunc(f func() null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetActive() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Active = 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 fsZoneMods) RandomActive(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Active = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomActiveNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Active = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Creationdate(val null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) CreationdateFunc(f func() null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetCreationdate() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creationdate = 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 fsZoneMods) RandomCreationdate(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Creator(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) CreatorFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetCreator() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creator = 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 fsZoneMods) RandomCreator(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Editdate(val null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) EditdateFunc(f func() null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetEditdate() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editdate = 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 fsZoneMods) RandomEditdate(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Editor(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) EditorFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetEditor() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editor = 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 fsZoneMods) RandomEditor(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Globalid(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) GlobalidFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetGlobalid() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Globalid = 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 fsZoneMods) RandomGlobalid(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Name(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) NameFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetName() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Name = 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 fsZoneMods) RandomName(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Objectid(val int32) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) ObjectidFunc(f func() int32) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetObjectid() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsZoneMods) RandomObjectid(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) ShapeArea(val null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) ShapeAreaFunc(f func() null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetShapeArea() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeArea = 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 fsZoneMods) RandomShapeArea(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) ShapeLength(val null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) ShapeLengthFunc(f func() null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetShapeLength() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeLength = 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 fsZoneMods) RandomShapeLength(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) CreatedDate(val null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) CreatedDateFunc(f func() null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetCreatedDate() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedDate = 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 fsZoneMods) RandomCreatedDate(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) CreatedUser(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) CreatedUserFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetCreatedUser() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedUser = 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 fsZoneMods) RandomCreatedUser(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) GeometryX(val null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) GeometryXFunc(f func() null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetGeometryX() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryX = 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 fsZoneMods) RandomGeometryX(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) GeometryY(val null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) GeometryYFunc(f func() null.Val[float64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetGeometryY() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryY = 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 fsZoneMods) RandomGeometryY(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) LastEditedDate(val null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) LastEditedDateFunc(f func() null.Val[int64]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetLastEditedDate() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedDate = 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 fsZoneMods) RandomLastEditedDate(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) LastEditedUser(val null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) LastEditedUserFunc(f func() null.Val[string]) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetLastEditedUser() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedUser = 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 fsZoneMods) RandomLastEditedUser(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZoneMods) Updated(val time.Time) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsZoneMods) UpdatedFunc(f func() time.Time) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsZoneMods) UnsetUpdated() FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsZoneMods) RandomUpdated(f *faker.Faker) FSZoneMod { + return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsZoneMods) WithParentsCascading() FSZoneMod { + return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { + if isDone, _ := fsZoneWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsZoneWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsZoneMods) WithOrganization(rel *OrganizationTemplate) FSZoneMod { + return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { + o.r.Organization = &fsZoneROrganizationR{ + o: rel, + } + }) +} + +func (m fsZoneMods) WithNewOrganization(mods ...OrganizationMod) FSZoneMod { + return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsZoneMods) WithExistingOrganization(em *models.Organization) FSZoneMod { + return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { + o.r.Organization = &fsZoneROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsZoneMods) WithoutOrganization() FSZoneMod { + return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_zones2.bob.go b/factory/fs_zones2.bob.go new file mode 100644 index 00000000..7d62f0ab --- /dev/null +++ b/factory/fs_zones2.bob.go @@ -0,0 +1,1298 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FSZones2Mod interface { + Apply(context.Context, *FSZones2Template) +} + +type FSZones2ModFunc func(context.Context, *FSZones2Template) + +func (f FSZones2ModFunc) Apply(ctx context.Context, n *FSZones2Template) { + f(ctx, n) +} + +type FSZones2ModSlice []FSZones2Mod + +func (mods FSZones2ModSlice) Apply(ctx context.Context, n *FSZones2Template) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Updated func() time.Time + + r fsZones2R + f *Factory + + alreadyPersisted bool +} + +type fsZones2R struct { + Organization *fsZones2ROrganizationR +} + +type fsZones2ROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FSZones2Template +func (o *FSZones2Template) Apply(ctx context.Context, mods ...FSZones2Mod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FSZones2 +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.FSZones2Setter +// this does nothing with the relationship templates +func (o FSZones2Template) BuildSetter() *models.FSZones2Setter { + m := &models.FSZones2Setter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Updated != nil { + val := o.Updated() + m.Updated = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FSZones2Setter +// this does nothing with the relationship templates +func (o FSZones2Template) BuildManySetter(number int) []*models.FSZones2Setter { + m := make([]*models.FSZones2Setter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FSZones2 +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSZones2Template.Create +func (o FSZones2Template) Build() *models.FSZones2 { + m := &models.FSZones2{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Updated != nil { + m.Updated = o.Updated() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FSZones2Slice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FSZones2Template.CreateMany +func (o FSZones2Template) BuildMany(number int) models.FSZones2Slice { + m := make(models.FSZones2Slice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFSZones2(m *models.FSZones2Setter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FSZones2 +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a fsZones2 and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FSZones2Template) Create(ctx context.Context, exec bob.Executor) (*models.FSZones2, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFSZones2(opt) + + m, err := models.FSZones2s.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fsZones2 and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FSZones2Template) MustCreate(ctx context.Context, exec bob.Executor) *models.FSZones2 { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fsZones2 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 *FSZones2Template) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSZones2 { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fsZones2s and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FSZones2Template) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSZones2Slice, error) { + var err error + m := make(models.FSZones2Slice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fsZones2s and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FSZones2Template) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSZones2Slice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fsZones2s 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 FSZones2Template) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSZones2Slice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FSZones2 has methods that act as mods for the FSZones2Template +var FSZones2Mods fsZones2Mods + +type fsZones2Mods struct{} + +func (m fsZones2Mods) RandomizeAllColumns(f *faker.Faker) FSZones2Mod { + return FSZones2ModSlice{ + FSZones2Mods.RandomOrganizationID(f), + FSZones2Mods.RandomCreationdate(f), + FSZones2Mods.RandomCreator(f), + FSZones2Mods.RandomEditdate(f), + FSZones2Mods.RandomEditor(f), + FSZones2Mods.RandomGlobalid(f), + FSZones2Mods.RandomName(f), + FSZones2Mods.RandomObjectid(f), + FSZones2Mods.RandomShapeArea(f), + FSZones2Mods.RandomShapeLength(f), + FSZones2Mods.RandomCreatedDate(f), + FSZones2Mods.RandomCreatedUser(f), + FSZones2Mods.RandomGeometryX(f), + FSZones2Mods.RandomGeometryY(f), + FSZones2Mods.RandomLastEditedDate(f), + FSZones2Mods.RandomLastEditedUser(f), + FSZones2Mods.RandomUpdated(f), + } +} + +// Set the model columns to this value +func (m fsZones2Mods) OrganizationID(val null.Val[int32]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) OrganizationIDFunc(f func() null.Val[int32]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetOrganizationID() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Creationdate(val null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) CreationdateFunc(f func() null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetCreationdate() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creationdate = 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 fsZones2Mods) RandomCreationdate(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Creator(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) CreatorFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetCreator() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creator = 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 fsZones2Mods) RandomCreator(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Editdate(val null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) EditdateFunc(f func() null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetEditdate() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editdate = 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 fsZones2Mods) RandomEditdate(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Editor(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) EditorFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetEditor() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editor = 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 fsZones2Mods) RandomEditor(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Globalid(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) GlobalidFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetGlobalid() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Globalid = 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 fsZones2Mods) RandomGlobalid(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Name(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) NameFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Name = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetName() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Name = 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 fsZones2Mods) RandomName(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Objectid(val int32) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) ObjectidFunc(f func() int32) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetObjectid() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsZones2Mods) RandomObjectid(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) ShapeArea(val null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) ShapeAreaFunc(f func() null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetShapeArea() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeArea = 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 fsZones2Mods) RandomShapeArea(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) ShapeLength(val null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) ShapeLengthFunc(f func() null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetShapeLength() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeLength = 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 fsZones2Mods) RandomShapeLength(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) CreatedDate(val null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) CreatedDateFunc(f func() null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetCreatedDate() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedDate = 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 fsZones2Mods) RandomCreatedDate(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) CreatedUser(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) CreatedUserFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetCreatedUser() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedUser = 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 fsZones2Mods) RandomCreatedUser(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) GeometryX(val null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) GeometryXFunc(f func() null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetGeometryX() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryX = 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 fsZones2Mods) RandomGeometryX(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) GeometryY(val null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) GeometryYFunc(f func() null.Val[float64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetGeometryY() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryY = 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 fsZones2Mods) RandomGeometryY(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) LastEditedDate(val null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) LastEditedDateFunc(f func() null.Val[int64]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetLastEditedDate() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedDate = 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 fsZones2Mods) RandomLastEditedDate(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) LastEditedUser(val null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) LastEditedUserFunc(f func() null.Val[string]) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetLastEditedUser() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedUser = 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 fsZones2Mods) RandomLastEditedUser(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fsZones2Mods) Updated(val time.Time) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Updated = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fsZones2Mods) UpdatedFunc(f func() time.Time) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Updated = f + }) +} + +// Clear any values for the column +func (m fsZones2Mods) UnsetUpdated() FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Updated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fsZones2Mods) RandomUpdated(f *faker.Faker) FSZones2Mod { + return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { + o.Updated = func() time.Time { + return random_time_Time(f) + } + }) +} + +func (m fsZones2Mods) WithParentsCascading() FSZones2Mod { + return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { + if isDone, _ := fsZones2WithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fsZones2WithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fsZones2Mods) WithOrganization(rel *OrganizationTemplate) FSZones2Mod { + return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { + o.r.Organization = &fsZones2ROrganizationR{ + o: rel, + } + }) +} + +func (m fsZones2Mods) WithNewOrganization(mods ...OrganizationMod) FSZones2Mod { + return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fsZones2Mods) WithExistingOrganization(em *models.Organization) FSZones2Mod { + return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { + o.r.Organization = &fsZones2ROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fsZones2Mods) WithoutOrganization() FSZones2Mod { + return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { + o.r.Organization = nil + }) +} diff --git a/factory/history_containerrelate.bob.go b/factory/history_containerrelate.bob.go new file mode 100644 index 00000000..4ef01b3f --- /dev/null +++ b/factory/history_containerrelate.bob.go @@ -0,0 +1,1363 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryContainerrelateMod interface { + Apply(context.Context, *HistoryContainerrelateTemplate) +} + +type HistoryContainerrelateModFunc func(context.Context, *HistoryContainerrelateTemplate) + +func (f HistoryContainerrelateModFunc) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) { + f(ctx, n) +} + +type HistoryContainerrelateModSlice []HistoryContainerrelateMod + +func (mods HistoryContainerrelateModSlice) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Containertype func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Inspsampleid func() null.Val[string] + Mosquitoinspid func() null.Val[string] + Objectid func() int32 + Treatmentid func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyContainerrelateR + f *Factory + + alreadyPersisted bool +} + +type historyContainerrelateR struct { + Organization *historyContainerrelateROrganizationR +} + +type historyContainerrelateROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryContainerrelateTemplate +func (o *HistoryContainerrelateTemplate) Apply(ctx context.Context, mods ...HistoryContainerrelateMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryContainerrelate +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryContainerrelateTemplate) setModelRels(o *models.HistoryContainerrelate) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryContainerrelateSetter +// this does nothing with the relationship templates +func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerrelateSetter { + m := &models.HistoryContainerrelateSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Containertype != nil { + val := o.Containertype() + m.Containertype = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Inspsampleid != nil { + val := o.Inspsampleid() + m.Inspsampleid = omitnull.FromNull(val) + } + if o.Mosquitoinspid != nil { + val := o.Mosquitoinspid() + m.Mosquitoinspid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Treatmentid != nil { + val := o.Treatmentid() + m.Treatmentid = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryContainerrelateSetter +// this does nothing with the relationship templates +func (o HistoryContainerrelateTemplate) BuildManySetter(number int) []*models.HistoryContainerrelateSetter { + m := make([]*models.HistoryContainerrelateSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryContainerrelate +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.Create +func (o HistoryContainerrelateTemplate) Build() *models.HistoryContainerrelate { + m := &models.HistoryContainerrelate{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Containertype != nil { + m.Containertype = o.Containertype() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Inspsampleid != nil { + m.Inspsampleid = o.Inspsampleid() + } + if o.Mosquitoinspid != nil { + m.Mosquitoinspid = o.Mosquitoinspid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Treatmentid != nil { + m.Treatmentid = o.Treatmentid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryContainerrelateSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.CreateMany +func (o HistoryContainerrelateTemplate) BuildMany(number int) models.HistoryContainerrelateSlice { + m := make(models.HistoryContainerrelateSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryContainerrelate +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyContainerrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryContainerrelate, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryContainerrelate(opt) + + m, err := models.HistoryContainerrelates.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyContainerrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryContainerrelate { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyContainerrelate 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 *HistoryContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryContainerrelate { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyContainerrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryContainerrelateSlice, error) { + var err error + m := make(models.HistoryContainerrelateSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyContainerrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryContainerrelateSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyContainerrelates 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 HistoryContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryContainerrelateSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryContainerrelate has methods that act as mods for the HistoryContainerrelateTemplate +var HistoryContainerrelateMods historyContainerrelateMods + +type historyContainerrelateMods struct{} + +func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModSlice{ + HistoryContainerrelateMods.RandomOrganizationID(f), + HistoryContainerrelateMods.RandomContainertype(f), + HistoryContainerrelateMods.RandomCreationdate(f), + HistoryContainerrelateMods.RandomCreator(f), + HistoryContainerrelateMods.RandomEditdate(f), + HistoryContainerrelateMods.RandomEditor(f), + HistoryContainerrelateMods.RandomGlobalid(f), + HistoryContainerrelateMods.RandomInspsampleid(f), + HistoryContainerrelateMods.RandomMosquitoinspid(f), + HistoryContainerrelateMods.RandomObjectid(f), + HistoryContainerrelateMods.RandomTreatmentid(f), + HistoryContainerrelateMods.RandomCreatedDate(f), + HistoryContainerrelateMods.RandomCreatedUser(f), + HistoryContainerrelateMods.RandomGeometryX(f), + HistoryContainerrelateMods.RandomGeometryY(f), + HistoryContainerrelateMods.RandomLastEditedDate(f), + HistoryContainerrelateMods.RandomLastEditedUser(f), + HistoryContainerrelateMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyContainerrelateMods) OrganizationID(val null.Val[int32]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetOrganizationID() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Containertype(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Containertype = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetContainertype() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Containertype = 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) RandomContainertype(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomContainertypeNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Containertype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Creationdate(val null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetCreationdate() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Creator(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) CreatorFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetCreator() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Editdate(val null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetEditdate() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Editor(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) EditorFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetEditor() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Globalid(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetGlobalid() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Inspsampleid(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Inspsampleid = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetInspsampleid() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Inspsampleid = 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) RandomInspsampleid(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspsampleidNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Inspsampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Mosquitoinspid(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Mosquitoinspid = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetMosquitoinspid() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Mosquitoinspid = 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) RandomMosquitoinspid(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMosquitoinspidNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Mosquitoinspid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Objectid(val int32) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) ObjectidFunc(f func() int32) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetObjectid() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyContainerrelateMods) RandomObjectid(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Treatmentid(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Treatmentid = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetTreatmentid() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Treatmentid = 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) RandomTreatmentid(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatmentidNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Treatmentid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetCreatedDate() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) CreatedUser(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetCreatedUser() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) GeometryX(val null.Val[float64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetGeometryX() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) GeometryY(val null.Val[float64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetGeometryY() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) LastEditedDate(val null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetLastEditedDate() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) LastEditedUser(val null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetLastEditedUser() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyContainerrelateMods) Version(val int32) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) VersionFunc(f func() int32) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetVersion() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyContainerrelateMods) RandomVersion(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyContainerrelateMods) WithParentsCascading() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { + if isDone, _ := historyContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyContainerrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { + o.r.Organization = &historyContainerrelateROrganizationR{ + o: rel, + } + }) +} + +func (m historyContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyContainerrelateMods) WithExistingOrganization(em *models.Organization) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { + o.r.Organization = &historyContainerrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyContainerrelateMods) WithoutOrganization() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_fieldscoutinglog.bob.go b/factory/history_fieldscoutinglog.bob.go new file mode 100644 index 00000000..4b4ec523 --- /dev/null +++ b/factory/history_fieldscoutinglog.bob.go @@ -0,0 +1,1177 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryFieldscoutinglogMod interface { + Apply(context.Context, *HistoryFieldscoutinglogTemplate) +} + +type HistoryFieldscoutinglogModFunc func(context.Context, *HistoryFieldscoutinglogTemplate) + +func (f HistoryFieldscoutinglogModFunc) Apply(ctx context.Context, n *HistoryFieldscoutinglogTemplate) { + f(ctx, n) +} + +type HistoryFieldscoutinglogModSlice []HistoryFieldscoutinglogMod + +func (mods HistoryFieldscoutinglogModSlice) Apply(ctx context.Context, n *HistoryFieldscoutinglogTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Objectid func() int32 + Status func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyFieldscoutinglogR + f *Factory + + alreadyPersisted bool +} + +type historyFieldscoutinglogR struct { + Organization *historyFieldscoutinglogROrganizationR +} + +type historyFieldscoutinglogROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryFieldscoutinglogTemplate +func (o *HistoryFieldscoutinglogTemplate) Apply(ctx context.Context, mods ...HistoryFieldscoutinglogMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryFieldscoutinglog +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryFieldscoutinglogTemplate) setModelRels(o *models.HistoryFieldscoutinglog) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryFieldscoutinglogSetter +// this does nothing with the relationship templates +func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscoutinglogSetter { + m := &models.HistoryFieldscoutinglogSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Status != nil { + val := o.Status() + m.Status = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryFieldscoutinglogSetter +// this does nothing with the relationship templates +func (o HistoryFieldscoutinglogTemplate) BuildManySetter(number int) []*models.HistoryFieldscoutinglogSetter { + m := make([]*models.HistoryFieldscoutinglogSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryFieldscoutinglog +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryFieldscoutinglogTemplate.Create +func (o HistoryFieldscoutinglogTemplate) Build() *models.HistoryFieldscoutinglog { + m := &models.HistoryFieldscoutinglog{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Status != nil { + m.Status = o.Status() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryFieldscoutinglogSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryFieldscoutinglogTemplate.CreateMany +func (o HistoryFieldscoutinglogTemplate) BuildMany(number int) models.HistoryFieldscoutinglogSlice { + m := make(models.HistoryFieldscoutinglogSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryFieldscoutinglog +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyFieldscoutinglog and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryFieldscoutinglog, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryFieldscoutinglog(opt) + + m, err := models.HistoryFieldscoutinglogs.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyFieldscoutinglog and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryFieldscoutinglog { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyFieldscoutinglog 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 *HistoryFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryFieldscoutinglog { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyFieldscoutinglogs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryFieldscoutinglogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryFieldscoutinglogSlice, error) { + var err error + m := make(models.HistoryFieldscoutinglogSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyFieldscoutinglogs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryFieldscoutinglogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryFieldscoutinglogSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyFieldscoutinglogs 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 HistoryFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryFieldscoutinglogSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryFieldscoutinglog has methods that act as mods for the HistoryFieldscoutinglogTemplate +var HistoryFieldscoutinglogMods historyFieldscoutinglogMods + +type historyFieldscoutinglogMods struct{} + +func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModSlice{ + HistoryFieldscoutinglogMods.RandomOrganizationID(f), + HistoryFieldscoutinglogMods.RandomCreationdate(f), + HistoryFieldscoutinglogMods.RandomCreator(f), + HistoryFieldscoutinglogMods.RandomEditdate(f), + HistoryFieldscoutinglogMods.RandomEditor(f), + HistoryFieldscoutinglogMods.RandomGlobalid(f), + HistoryFieldscoutinglogMods.RandomObjectid(f), + HistoryFieldscoutinglogMods.RandomStatus(f), + HistoryFieldscoutinglogMods.RandomCreatedDate(f), + HistoryFieldscoutinglogMods.RandomCreatedUser(f), + HistoryFieldscoutinglogMods.RandomGeometryX(f), + HistoryFieldscoutinglogMods.RandomGeometryY(f), + HistoryFieldscoutinglogMods.RandomLastEditedDate(f), + HistoryFieldscoutinglogMods.RandomLastEditedUser(f), + HistoryFieldscoutinglogMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) OrganizationID(val null.Val[int32]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetOrganizationID() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Creationdate(val null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) CreationdateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetCreationdate() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Creator(val null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetCreator() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Editdate(val null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) EditdateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetEditdate() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Editor(val null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetEditor() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Globalid(val null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) GlobalidFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetGlobalid() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Objectid(val int32) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) ObjectidFunc(f func() int32) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetObjectid() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyFieldscoutinglogMods) RandomObjectid(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Status(val null.Val[int16]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Status = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetStatus() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Status = 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) RandomStatus(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomStatusNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Status = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetCreatedDate() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) CreatedUser(val null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetCreatedUser() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) GeometryX(val null.Val[float64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) GeometryXFunc(f func() null.Val[float64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetGeometryX() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) GeometryY(val null.Val[float64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) GeometryYFunc(f func() null.Val[float64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetGeometryY() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) LastEditedDate(val null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetLastEditedDate() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) LastEditedUser(val null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetLastEditedUser() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Version(val int32) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) VersionFunc(f func() int32) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetVersion() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyFieldscoutinglogMods) RandomVersion(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyFieldscoutinglogMods) WithParentsCascading() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { + if isDone, _ := historyFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { + o.r.Organization = &historyFieldscoutinglogROrganizationR{ + o: rel, + } + }) +} + +func (m historyFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { + o.r.Organization = &historyFieldscoutinglogROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyFieldscoutinglogMods) WithoutOrganization() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_habitatrelate.bob.go b/factory/history_habitatrelate.bob.go new file mode 100644 index 00000000..8ffeaaef --- /dev/null +++ b/factory/history_habitatrelate.bob.go @@ -0,0 +1,1239 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryHabitatrelateMod interface { + Apply(context.Context, *HistoryHabitatrelateTemplate) +} + +type HistoryHabitatrelateModFunc func(context.Context, *HistoryHabitatrelateTemplate) + +func (f HistoryHabitatrelateModFunc) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) { + f(ctx, n) +} + +type HistoryHabitatrelateModSlice []HistoryHabitatrelateMod + +func (mods HistoryHabitatrelateModSlice) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + ForeignID func() null.Val[string] + Globalid func() null.Val[string] + Habitattype func() null.Val[string] + Objectid func() int32 + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyHabitatrelateR + f *Factory + + alreadyPersisted bool +} + +type historyHabitatrelateR struct { + Organization *historyHabitatrelateROrganizationR +} + +type historyHabitatrelateROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryHabitatrelateTemplate +func (o *HistoryHabitatrelateTemplate) Apply(ctx context.Context, mods ...HistoryHabitatrelateMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryHabitatrelate +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryHabitatrelateTemplate) setModelRels(o *models.HistoryHabitatrelate) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryHabitatrelateSetter +// this does nothing with the relationship templates +func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelateSetter { + m := &models.HistoryHabitatrelateSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.ForeignID != nil { + val := o.ForeignID() + m.ForeignID = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitattype != nil { + val := o.Habitattype() + m.Habitattype = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryHabitatrelateSetter +// this does nothing with the relationship templates +func (o HistoryHabitatrelateTemplate) BuildManySetter(number int) []*models.HistoryHabitatrelateSetter { + m := make([]*models.HistoryHabitatrelateSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryHabitatrelate +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.Create +func (o HistoryHabitatrelateTemplate) Build() *models.HistoryHabitatrelate { + m := &models.HistoryHabitatrelate{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.ForeignID != nil { + m.ForeignID = o.ForeignID() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitattype != nil { + m.Habitattype = o.Habitattype() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryHabitatrelateSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.CreateMany +func (o HistoryHabitatrelateTemplate) BuildMany(number int) models.HistoryHabitatrelateSlice { + m := make(models.HistoryHabitatrelateSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryHabitatrelate +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyHabitatrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryHabitatrelate, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryHabitatrelate(opt) + + m, err := models.HistoryHabitatrelates.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyHabitatrelate and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryHabitatrelate { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyHabitatrelate 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 *HistoryHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryHabitatrelate { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyHabitatrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryHabitatrelateSlice, error) { + var err error + m := make(models.HistoryHabitatrelateSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyHabitatrelates and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryHabitatrelateSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyHabitatrelates 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 HistoryHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryHabitatrelateSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryHabitatrelate has methods that act as mods for the HistoryHabitatrelateTemplate +var HistoryHabitatrelateMods historyHabitatrelateMods + +type historyHabitatrelateMods struct{} + +func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModSlice{ + HistoryHabitatrelateMods.RandomOrganizationID(f), + HistoryHabitatrelateMods.RandomCreationdate(f), + HistoryHabitatrelateMods.RandomCreator(f), + HistoryHabitatrelateMods.RandomEditdate(f), + HistoryHabitatrelateMods.RandomEditor(f), + HistoryHabitatrelateMods.RandomForeignID(f), + HistoryHabitatrelateMods.RandomGlobalid(f), + HistoryHabitatrelateMods.RandomHabitattype(f), + HistoryHabitatrelateMods.RandomObjectid(f), + HistoryHabitatrelateMods.RandomCreatedDate(f), + HistoryHabitatrelateMods.RandomCreatedUser(f), + HistoryHabitatrelateMods.RandomGeometryX(f), + HistoryHabitatrelateMods.RandomGeometryY(f), + HistoryHabitatrelateMods.RandomLastEditedDate(f), + HistoryHabitatrelateMods.RandomLastEditedUser(f), + HistoryHabitatrelateMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) OrganizationID(val null.Val[int32]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetOrganizationID() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Creationdate(val null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetCreationdate() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Creator(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) CreatorFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetCreator() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Editdate(val null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetEditdate() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Editor(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) EditorFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetEditor() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) ForeignID(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) ForeignIDFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.ForeignID = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetForeignID() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.ForeignID = 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) RandomForeignID(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomForeignIDNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.ForeignID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Globalid(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetGlobalid() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Habitattype(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Habitattype = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetHabitattype() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Habitattype = 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) RandomHabitattype(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitattypeNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Habitattype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Objectid(val int32) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) ObjectidFunc(f func() int32) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetObjectid() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyHabitatrelateMods) RandomObjectid(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) CreatedDate(val null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetCreatedDate() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) CreatedUser(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetCreatedUser() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) GeometryX(val null.Val[float64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetGeometryX() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) GeometryY(val null.Val[float64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetGeometryY() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) LastEditedDate(val null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetLastEditedDate() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) LastEditedUser(val null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetLastEditedUser() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyHabitatrelateMods) Version(val int32) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) VersionFunc(f func() int32) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetVersion() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyHabitatrelateMods) RandomVersion(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyHabitatrelateMods) WithParentsCascading() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { + if isDone, _ := historyHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { + o.r.Organization = &historyHabitatrelateROrganizationR{ + o: rel, + } + }) +} + +func (m historyHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyHabitatrelateMods) WithExistingOrganization(em *models.Organization) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { + o.r.Organization = &historyHabitatrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyHabitatrelateMods) WithoutOrganization() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_inspectionsample.bob.go b/factory/history_inspectionsample.bob.go new file mode 100644 index 00000000..f8235121 --- /dev/null +++ b/factory/history_inspectionsample.bob.go @@ -0,0 +1,1363 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryInspectionsampleMod interface { + Apply(context.Context, *HistoryInspectionsampleTemplate) +} + +type HistoryInspectionsampleModFunc func(context.Context, *HistoryInspectionsampleTemplate) + +func (f HistoryInspectionsampleModFunc) Apply(ctx context.Context, n *HistoryInspectionsampleTemplate) { + f(ctx, n) +} + +type HistoryInspectionsampleModSlice []HistoryInspectionsampleMod + +func (mods HistoryInspectionsampleModSlice) Apply(ctx context.Context, n *HistoryInspectionsampleTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Idbytech func() null.Val[string] + InspID func() null.Val[string] + Objectid func() int32 + Processed func() null.Val[int16] + Sampleid func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyInspectionsampleR + f *Factory + + alreadyPersisted bool +} + +type historyInspectionsampleR struct { + Organization *historyInspectionsampleROrganizationR +} + +type historyInspectionsampleROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryInspectionsampleTemplate +func (o *HistoryInspectionsampleTemplate) Apply(ctx context.Context, mods ...HistoryInspectionsampleMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryInspectionsample +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryInspectionsampleTemplate) setModelRels(o *models.HistoryInspectionsample) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryInspectionsampleSetter +// this does nothing with the relationship templates +func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspectionsampleSetter { + m := &models.HistoryInspectionsampleSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Idbytech != nil { + val := o.Idbytech() + m.Idbytech = omitnull.FromNull(val) + } + if o.InspID != nil { + val := o.InspID() + m.InspID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryInspectionsampleSetter +// this does nothing with the relationship templates +func (o HistoryInspectionsampleTemplate) BuildManySetter(number int) []*models.HistoryInspectionsampleSetter { + m := make([]*models.HistoryInspectionsampleSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryInspectionsample +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampleTemplate.Create +func (o HistoryInspectionsampleTemplate) Build() *models.HistoryInspectionsample { + m := &models.HistoryInspectionsample{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Idbytech != nil { + m.Idbytech = o.Idbytech() + } + if o.InspID != nil { + m.InspID = o.InspID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryInspectionsampleSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampleTemplate.CreateMany +func (o HistoryInspectionsampleTemplate) BuildMany(number int) models.HistoryInspectionsampleSlice { + m := make(models.HistoryInspectionsampleSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryInspectionsample +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyInspectionsample and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryInspectionsample, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryInspectionsample(opt) + + m, err := models.HistoryInspectionsamples.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyInspectionsample and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryInspectionsample { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyInspectionsample 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 *HistoryInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryInspectionsample { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyInspectionsamples and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryInspectionsampleSlice, error) { + var err error + m := make(models.HistoryInspectionsampleSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyInspectionsamples and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryInspectionsampleSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyInspectionsamples 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 HistoryInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryInspectionsampleSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryInspectionsample has methods that act as mods for the HistoryInspectionsampleTemplate +var HistoryInspectionsampleMods historyInspectionsampleMods + +type historyInspectionsampleMods struct{} + +func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModSlice{ + HistoryInspectionsampleMods.RandomOrganizationID(f), + HistoryInspectionsampleMods.RandomCreationdate(f), + HistoryInspectionsampleMods.RandomCreator(f), + HistoryInspectionsampleMods.RandomEditdate(f), + HistoryInspectionsampleMods.RandomEditor(f), + HistoryInspectionsampleMods.RandomGlobalid(f), + HistoryInspectionsampleMods.RandomIdbytech(f), + HistoryInspectionsampleMods.RandomInspID(f), + HistoryInspectionsampleMods.RandomObjectid(f), + HistoryInspectionsampleMods.RandomProcessed(f), + HistoryInspectionsampleMods.RandomSampleid(f), + HistoryInspectionsampleMods.RandomCreatedDate(f), + HistoryInspectionsampleMods.RandomCreatedUser(f), + HistoryInspectionsampleMods.RandomGeometryX(f), + HistoryInspectionsampleMods.RandomGeometryY(f), + HistoryInspectionsampleMods.RandomLastEditedDate(f), + HistoryInspectionsampleMods.RandomLastEditedUser(f), + HistoryInspectionsampleMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetOrganizationID() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Creationdate(val null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) CreationdateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetCreationdate() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Creator(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) CreatorFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetCreator() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Editdate(val null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) EditdateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetEditdate() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Editor(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) EditorFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetEditor() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Globalid(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) GlobalidFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetGlobalid() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Idbytech(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Idbytech = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetIdbytech() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Idbytech = 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) RandomIdbytech(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIdbytechNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) InspID(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) InspIDFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.InspID = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetInspID() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.InspID = 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) RandomInspID(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspIDNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Objectid(val int32) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) ObjectidFunc(f func() int32) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetObjectid() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyInspectionsampleMods) RandomObjectid(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Processed(val null.Val[int16]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetProcessed() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Sampleid(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) SampleidFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetSampleid() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Sampleid = 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) RandomSampleid(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) CreatedDateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetCreatedDate() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) CreatedUser(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetCreatedUser() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) GeometryX(val null.Val[float64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) GeometryXFunc(f func() null.Val[float64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetGeometryX() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) GeometryY(val null.Val[float64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) GeometryYFunc(f func() null.Val[float64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetGeometryY() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) LastEditedDate(val null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetLastEditedDate() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) LastEditedUser(val null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetLastEditedUser() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampleMods) Version(val int32) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) VersionFunc(f func() int32) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetVersion() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyInspectionsampleMods) RandomVersion(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyInspectionsampleMods) WithParentsCascading() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { + if isDone, _ := historyInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { + o.r.Organization = &historyInspectionsampleROrganizationR{ + o: rel, + } + }) +} + +func (m historyInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyInspectionsampleMods) WithExistingOrganization(em *models.Organization) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { + o.r.Organization = &historyInspectionsampleROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyInspectionsampleMods) WithoutOrganization() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_inspectionsampledetail.bob.go b/factory/history_inspectionsampledetail.bob.go new file mode 100644 index 00000000..961181ab --- /dev/null +++ b/factory/history_inspectionsampledetail.bob.go @@ -0,0 +1,2045 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryInspectionsampledetailMod interface { + Apply(context.Context, *HistoryInspectionsampledetailTemplate) +} + +type HistoryInspectionsampledetailModFunc func(context.Context, *HistoryInspectionsampledetailTemplate) + +func (f HistoryInspectionsampledetailModFunc) Apply(ctx context.Context, n *HistoryInspectionsampledetailTemplate) { + f(ctx, n) +} + +type HistoryInspectionsampledetailModSlice []HistoryInspectionsampledetailMod + +func (mods HistoryInspectionsampledetailModSlice) Apply(ctx context.Context, n *HistoryInspectionsampledetailTemplate) { + for _, f := range mods { + f.Apply(ctx, 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fadultact func() null.Val[string] + Fdomstage func() null.Val[string] + Feggcount func() null.Val[int16] + Fieldspecies func() null.Val[string] + Flarvcount func() null.Val[int16] + Flstages func() null.Val[string] + Fpupcount func() null.Val[int16] + Globalid func() null.Val[string] + InspsampleID func() null.Val[string] + Labspecies func() null.Val[string] + Ldomstage func() null.Val[string] + Leggcount func() null.Val[int16] + Llarvcount func() null.Val[int16] + Lpupcount func() null.Val[int16] + Objectid func() int32 + Processed func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyInspectionsampledetailR + f *Factory + + alreadyPersisted bool +} + +type historyInspectionsampledetailR struct { + Organization *historyInspectionsampledetailROrganizationR +} + +type historyInspectionsampledetailROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryInspectionsampledetailTemplate +func (o *HistoryInspectionsampledetailTemplate) Apply(ctx context.Context, mods ...HistoryInspectionsampledetailMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryInspectionsampledetail +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryInspectionsampledetailTemplate) setModelRels(o *models.HistoryInspectionsampledetail) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryInspectionsampledetailSetter +// this does nothing with the relationship templates +func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInspectionsampledetailSetter { + m := &models.HistoryInspectionsampledetailSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fadultact != nil { + val := o.Fadultact() + m.Fadultact = omitnull.FromNull(val) + } + if o.Fdomstage != nil { + val := o.Fdomstage() + m.Fdomstage = omitnull.FromNull(val) + } + if o.Feggcount != nil { + val := o.Feggcount() + m.Feggcount = omitnull.FromNull(val) + } + if o.Fieldspecies != nil { + val := o.Fieldspecies() + m.Fieldspecies = omitnull.FromNull(val) + } + if o.Flarvcount != nil { + val := o.Flarvcount() + m.Flarvcount = omitnull.FromNull(val) + } + if o.Flstages != nil { + val := o.Flstages() + m.Flstages = omitnull.FromNull(val) + } + if o.Fpupcount != nil { + val := o.Fpupcount() + m.Fpupcount = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.InspsampleID != nil { + val := o.InspsampleID() + m.InspsampleID = omitnull.FromNull(val) + } + if o.Labspecies != nil { + val := o.Labspecies() + m.Labspecies = omitnull.FromNull(val) + } + if o.Ldomstage != nil { + val := o.Ldomstage() + m.Ldomstage = omitnull.FromNull(val) + } + if o.Leggcount != nil { + val := o.Leggcount() + m.Leggcount = omitnull.FromNull(val) + } + if o.Llarvcount != nil { + val := o.Llarvcount() + m.Llarvcount = omitnull.FromNull(val) + } + if o.Lpupcount != nil { + val := o.Lpupcount() + m.Lpupcount = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryInspectionsampledetailSetter +// this does nothing with the relationship templates +func (o HistoryInspectionsampledetailTemplate) BuildManySetter(number int) []*models.HistoryInspectionsampledetailSetter { + m := make([]*models.HistoryInspectionsampledetailSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryInspectionsampledetail +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampledetailTemplate.Create +func (o HistoryInspectionsampledetailTemplate) Build() *models.HistoryInspectionsampledetail { + m := &models.HistoryInspectionsampledetail{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fadultact != nil { + m.Fadultact = o.Fadultact() + } + if o.Fdomstage != nil { + m.Fdomstage = o.Fdomstage() + } + if o.Feggcount != nil { + m.Feggcount = o.Feggcount() + } + if o.Fieldspecies != nil { + m.Fieldspecies = o.Fieldspecies() + } + if o.Flarvcount != nil { + m.Flarvcount = o.Flarvcount() + } + if o.Flstages != nil { + m.Flstages = o.Flstages() + } + if o.Fpupcount != nil { + m.Fpupcount = o.Fpupcount() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.InspsampleID != nil { + m.InspsampleID = o.InspsampleID() + } + if o.Labspecies != nil { + m.Labspecies = o.Labspecies() + } + if o.Ldomstage != nil { + m.Ldomstage = o.Ldomstage() + } + if o.Leggcount != nil { + m.Leggcount = o.Leggcount() + } + if o.Llarvcount != nil { + m.Llarvcount = o.Llarvcount() + } + if o.Lpupcount != nil { + m.Lpupcount = o.Lpupcount() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryInspectionsampledetailSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampledetailTemplate.CreateMany +func (o HistoryInspectionsampledetailTemplate) BuildMany(number int) models.HistoryInspectionsampledetailSlice { + m := make(models.HistoryInspectionsampledetailSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetailSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryInspectionsampledetail +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyInspectionsampledetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryInspectionsampledetail, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryInspectionsampledetail(opt) + + m, err := models.HistoryInspectionsampledetails.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyInspectionsampledetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryInspectionsampledetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryInspectionsampledetail { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyInspectionsampledetail 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 *HistoryInspectionsampledetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryInspectionsampledetail { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyInspectionsampledetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryInspectionsampledetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryInspectionsampledetailSlice, error) { + var err error + m := make(models.HistoryInspectionsampledetailSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyInspectionsampledetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryInspectionsampledetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryInspectionsampledetailSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyInspectionsampledetails 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 HistoryInspectionsampledetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryInspectionsampledetailSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryInspectionsampledetail has methods that act as mods for the HistoryInspectionsampledetailTemplate +var HistoryInspectionsampledetailMods historyInspectionsampledetailMods + +type historyInspectionsampledetailMods struct{} + +func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModSlice{ + HistoryInspectionsampledetailMods.RandomOrganizationID(f), + HistoryInspectionsampledetailMods.RandomComments(f), + HistoryInspectionsampledetailMods.RandomCreationdate(f), + HistoryInspectionsampledetailMods.RandomCreator(f), + HistoryInspectionsampledetailMods.RandomEditdate(f), + HistoryInspectionsampledetailMods.RandomEditor(f), + HistoryInspectionsampledetailMods.RandomFadultact(f), + HistoryInspectionsampledetailMods.RandomFdomstage(f), + HistoryInspectionsampledetailMods.RandomFeggcount(f), + HistoryInspectionsampledetailMods.RandomFieldspecies(f), + HistoryInspectionsampledetailMods.RandomFlarvcount(f), + HistoryInspectionsampledetailMods.RandomFlstages(f), + HistoryInspectionsampledetailMods.RandomFpupcount(f), + HistoryInspectionsampledetailMods.RandomGlobalid(f), + HistoryInspectionsampledetailMods.RandomInspsampleID(f), + HistoryInspectionsampledetailMods.RandomLabspecies(f), + HistoryInspectionsampledetailMods.RandomLdomstage(f), + HistoryInspectionsampledetailMods.RandomLeggcount(f), + HistoryInspectionsampledetailMods.RandomLlarvcount(f), + HistoryInspectionsampledetailMods.RandomLpupcount(f), + HistoryInspectionsampledetailMods.RandomObjectid(f), + HistoryInspectionsampledetailMods.RandomProcessed(f), + HistoryInspectionsampledetailMods.RandomCreatedDate(f), + HistoryInspectionsampledetailMods.RandomCreatedUser(f), + HistoryInspectionsampledetailMods.RandomGeometryX(f), + HistoryInspectionsampledetailMods.RandomGeometryY(f), + HistoryInspectionsampledetailMods.RandomLastEditedDate(f), + HistoryInspectionsampledetailMods.RandomLastEditedUser(f), + HistoryInspectionsampledetailMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetOrganizationID() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Comments(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CommentsFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetComments() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Creationdate(val null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CreationdateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetCreationdate() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Creator(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CreatorFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetCreator() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Editdate(val null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) EditdateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetEditdate() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Editor(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) EditorFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetEditor() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Fadultact(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fadultact = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFadultact() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fadultact = 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) RandomFadultact(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFadultactNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fadultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Fdomstage(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fdomstage = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFdomstage() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fdomstage = 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) RandomFdomstage(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFdomstageNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fdomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Feggcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FeggcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Feggcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFeggcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Feggcount = 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) RandomFeggcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFeggcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Feggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Fieldspecies(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fieldspecies = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFieldspecies() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fieldspecies = 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) RandomFieldspecies(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldspeciesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Flarvcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FlarvcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flarvcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFlarvcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flarvcount = 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) RandomFlarvcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFlarvcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Flstages(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FlstagesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flstages = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFlstages() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flstages = 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) RandomFlstages(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFlstagesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Flstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Fpupcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) FpupcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fpupcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetFpupcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fpupcount = 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) RandomFpupcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFpupcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Fpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Globalid(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) GlobalidFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetGlobalid() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) InspsampleID(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) InspsampleIDFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.InspsampleID = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetInspsampleID() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.InspsampleID = 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) RandomInspsampleID(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspsampleIDNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.InspsampleID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Labspecies(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LabspeciesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Labspecies = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLabspecies() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Labspecies = 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) RandomLabspecies(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabspeciesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Labspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Ldomstage(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Ldomstage = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLdomstage() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Ldomstage = 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) RandomLdomstage(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLdomstageNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Ldomstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Leggcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LeggcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Leggcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLeggcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Leggcount = 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) RandomLeggcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLeggcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Leggcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Llarvcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LlarvcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Llarvcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLlarvcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Llarvcount = 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) RandomLlarvcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLlarvcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Llarvcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Lpupcount(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LpupcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Lpupcount = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLpupcount() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Lpupcount = 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) RandomLpupcount(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLpupcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Lpupcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Objectid(val int32) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) ObjectidFunc(f func() int32) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetObjectid() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyInspectionsampledetailMods) RandomObjectid(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Processed(val null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) ProcessedFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetProcessed() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CreatedDateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetCreatedDate() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) CreatedUser(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CreatedUserFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetCreatedUser() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) GeometryX(val null.Val[float64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) GeometryXFunc(f func() null.Val[float64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetGeometryX() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) GeometryY(val null.Val[float64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) GeometryYFunc(f func() null.Val[float64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetGeometryY() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) LastEditedDate(val null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLastEditedDate() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) LastEditedUser(val null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) LastEditedUserFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetLastEditedUser() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Version(val int32) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) VersionFunc(f func() int32) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetVersion() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyInspectionsampledetailMods) RandomVersion(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyInspectionsampledetailMods) WithParentsCascading() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { + if isDone, _ := historyInspectionsampledetailWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyInspectionsampledetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyInspectionsampledetailMods) WithOrganization(rel *OrganizationTemplate) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { + o.r.Organization = &historyInspectionsampledetailROrganizationR{ + o: rel, + } + }) +} + +func (m historyInspectionsampledetailMods) WithNewOrganization(mods ...OrganizationMod) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyInspectionsampledetailMods) WithExistingOrganization(em *models.Organization) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { + o.r.Organization = &historyInspectionsampledetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyInspectionsampledetailMods) WithoutOrganization() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_linelocation.bob.go b/factory/history_linelocation.bob.go new file mode 100644 index 00000000..f15752e8 --- /dev/null +++ b/factory/history_linelocation.bob.go @@ -0,0 +1,3471 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryLinelocationMod interface { + Apply(context.Context, *HistoryLinelocationTemplate) +} + +type HistoryLinelocationModFunc func(context.Context, *HistoryLinelocationTemplate) + +func (f HistoryLinelocationModFunc) Apply(ctx context.Context, n *HistoryLinelocationTemplate) { + f(ctx, n) +} + +type HistoryLinelocationModSlice []HistoryLinelocationMod + +func (mods HistoryLinelocationModSlice) Apply(ctx context.Context, n *HistoryLinelocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Acres func() null.Val[float64] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Hectares func() null.Val[float64] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + LengthFT func() null.Val[float64] + LengthMeters func() null.Val[float64] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + ShapeLength func() null.Val[float64] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + WidthFT func() null.Val[float64] + WidthMeters func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyLinelocationR + f *Factory + + alreadyPersisted bool +} + +type historyLinelocationR struct { + Organization *historyLinelocationROrganizationR +} + +type historyLinelocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryLinelocationTemplate +func (o *HistoryLinelocationTemplate) Apply(ctx context.Context, mods ...HistoryLinelocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryLinelocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryLinelocationSetter +// this does nothing with the relationship templates +func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSetter { + m := &models.HistoryLinelocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.LengthFT != nil { + val := o.LengthFT() + m.LengthFT = omitnull.FromNull(val) + } + if o.LengthMeters != nil { + val := o.LengthMeters() + m.LengthMeters = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.WidthFT != nil { + val := o.WidthFT() + m.WidthFT = omitnull.FromNull(val) + } + if o.WidthMeters != nil { + val := o.WidthMeters() + m.WidthMeters = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryLinelocationSetter +// this does nothing with the relationship templates +func (o HistoryLinelocationTemplate) BuildManySetter(number int) []*models.HistoryLinelocationSetter { + m := make([]*models.HistoryLinelocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryLinelocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryLinelocationTemplate.Create +func (o HistoryLinelocationTemplate) Build() *models.HistoryLinelocation { + m := &models.HistoryLinelocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.LengthFT != nil { + m.LengthFT = o.LengthFT() + } + if o.LengthMeters != nil { + m.LengthMeters = o.LengthMeters() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.WidthFT != nil { + m.WidthFT = o.WidthFT() + } + if o.WidthMeters != nil { + m.WidthMeters = o.WidthMeters() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryLinelocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryLinelocationTemplate.CreateMany +func (o HistoryLinelocationTemplate) BuildMany(number int) models.HistoryLinelocationSlice { + m := make(models.HistoryLinelocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryLinelocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyLinelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryLinelocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryLinelocation(opt) + + m, err := models.HistoryLinelocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyLinelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryLinelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryLinelocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyLinelocation 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 *HistoryLinelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryLinelocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyLinelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryLinelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryLinelocationSlice, error) { + var err error + m := make(models.HistoryLinelocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyLinelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryLinelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryLinelocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyLinelocations 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 HistoryLinelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryLinelocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryLinelocation has methods that act as mods for the HistoryLinelocationTemplate +var HistoryLinelocationMods historyLinelocationMods + +type historyLinelocationMods struct{} + +func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModSlice{ + HistoryLinelocationMods.RandomOrganizationID(f), + HistoryLinelocationMods.RandomAccessdesc(f), + HistoryLinelocationMods.RandomAcres(f), + HistoryLinelocationMods.RandomActive(f), + HistoryLinelocationMods.RandomComments(f), + HistoryLinelocationMods.RandomCreationdate(f), + HistoryLinelocationMods.RandomCreator(f), + HistoryLinelocationMods.RandomDescription(f), + HistoryLinelocationMods.RandomExternalid(f), + HistoryLinelocationMods.RandomEditdate(f), + HistoryLinelocationMods.RandomEditor(f), + HistoryLinelocationMods.RandomGlobalid(f), + HistoryLinelocationMods.RandomHabitat(f), + HistoryLinelocationMods.RandomHectares(f), + HistoryLinelocationMods.RandomJurisdiction(f), + HistoryLinelocationMods.RandomLarvinspectinterval(f), + HistoryLinelocationMods.RandomLastinspectactiontaken(f), + HistoryLinelocationMods.RandomLastinspectactivity(f), + HistoryLinelocationMods.RandomLastinspectavglarvae(f), + HistoryLinelocationMods.RandomLastinspectavgpupae(f), + HistoryLinelocationMods.RandomLastinspectbreeding(f), + HistoryLinelocationMods.RandomLastinspectconditions(f), + HistoryLinelocationMods.RandomLastinspectdate(f), + HistoryLinelocationMods.RandomLastinspectfieldspecies(f), + HistoryLinelocationMods.RandomLastinspectlstages(f), + HistoryLinelocationMods.RandomLasttreatactivity(f), + HistoryLinelocationMods.RandomLasttreatdate(f), + HistoryLinelocationMods.RandomLasttreatproduct(f), + HistoryLinelocationMods.RandomLasttreatqty(f), + HistoryLinelocationMods.RandomLasttreatqtyunit(f), + HistoryLinelocationMods.RandomLengthFT(f), + HistoryLinelocationMods.RandomLengthMeters(f), + HistoryLinelocationMods.RandomLocationnumber(f), + HistoryLinelocationMods.RandomName(f), + HistoryLinelocationMods.RandomNextactiondatescheduled(f), + HistoryLinelocationMods.RandomObjectid(f), + HistoryLinelocationMods.RandomPriority(f), + HistoryLinelocationMods.RandomSymbology(f), + HistoryLinelocationMods.RandomShapeLength(f), + HistoryLinelocationMods.RandomUsetype(f), + HistoryLinelocationMods.RandomWaterorigin(f), + HistoryLinelocationMods.RandomWidthFT(f), + HistoryLinelocationMods.RandomWidthMeters(f), + HistoryLinelocationMods.RandomZone(f), + HistoryLinelocationMods.RandomZone2(f), + HistoryLinelocationMods.RandomCreatedDate(f), + HistoryLinelocationMods.RandomCreatedUser(f), + HistoryLinelocationMods.RandomGeometryX(f), + HistoryLinelocationMods.RandomGeometryY(f), + HistoryLinelocationMods.RandomLastEditedDate(f), + HistoryLinelocationMods.RandomLastEditedUser(f), + HistoryLinelocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyLinelocationMods) OrganizationID(val null.Val[int32]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetOrganizationID() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Accessdesc(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) AccessdescFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetAccessdesc() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Accessdesc = 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) RandomAccessdesc(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Acres(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) AcresFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetAcres() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Acres = 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) RandomAcres(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Active(val null.Val[int16]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) ActiveFunc(f func() null.Val[int16]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetActive() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Active = 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) RandomActive(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Comments(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CommentsFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetComments() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Creationdate(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetCreationdate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Creator(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CreatorFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetCreator() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Description(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) DescriptionFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetDescription() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Description = 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) RandomDescription(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Externalid(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) ExternalidFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetExternalid() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Editdate(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) EditdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetEditdate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Editor(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) EditorFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetEditor() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Globalid(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) GlobalidFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetGlobalid() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Habitat(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) HabitatFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetHabitat() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Habitat = 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) RandomHabitat(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Hectares(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) HectaresFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetHectares() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Hectares = 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) RandomHectares(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Jurisdiction(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetJurisdiction() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Jurisdiction = 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) RandomJurisdiction(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Larvinspectinterval(val null.Val[int16]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLarvinspectinterval() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Larvinspectinterval = 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) RandomLarvinspectinterval(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectactiontaken() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactiontaken = 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) RandomLastinspectactiontaken(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectactivity(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectactivity() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactivity = 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) RandomLastinspectactivity(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectavglarvae() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavglarvae = 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) RandomLastinspectavglarvae(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectavgpupae() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavgpupae = 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) RandomLastinspectavgpupae(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectbreeding(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectbreeding() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectbreeding = 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) RandomLastinspectbreeding(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectconditions(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectconditions() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectconditions = 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) RandomLastinspectconditions(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectdate(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectdate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectdate = 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) RandomLastinspectdate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectfieldspecies() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectfieldspecies = 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) RandomLastinspectfieldspecies(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lastinspectlstages(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastinspectlstages() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectlstages = 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) RandomLastinspectlstages(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lasttreatactivity(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLasttreatactivity() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatactivity = 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) RandomLasttreatactivity(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lasttreatdate(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLasttreatdate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatdate = 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) RandomLasttreatdate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lasttreatproduct(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLasttreatproduct() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatproduct = 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) RandomLasttreatproduct(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lasttreatqty(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLasttreatqty() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqty = 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) RandomLasttreatqty(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLasttreatqtyunit() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqtyunit = 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) RandomLasttreatqtyunit(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) LengthFT(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LengthFTFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthFT = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLengthFT() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthFT = 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) RandomLengthFT(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLengthFTNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) LengthMeters(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LengthMetersFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthMeters = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLengthMeters() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthMeters = 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) RandomLengthMeters(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLengthMetersNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LengthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Locationnumber(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLocationnumber() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Locationnumber = 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) RandomLocationnumber(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Name(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) NameFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetName() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Name = 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) RandomName(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetNextactiondatescheduled() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Nextactiondatescheduled = 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) RandomNextactiondatescheduled(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Objectid(val int32) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) ObjectidFunc(f func() int32) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetObjectid() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyLinelocationMods) RandomObjectid(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Priority(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) PriorityFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetPriority() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Priority = 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) RandomPriority(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Symbology(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) SymbologyFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetSymbology() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Symbology = 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) RandomSymbology(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) ShapeLength(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetShapeLength() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.ShapeLength = 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) RandomShapeLength(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Usetype(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) UsetypeFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetUsetype() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Usetype = 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) RandomUsetype(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Waterorigin(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) WateroriginFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetWaterorigin() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Waterorigin = 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) RandomWaterorigin(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) WidthFT(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) WidthFTFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthFT = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetWidthFT() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthFT = 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) RandomWidthFT(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWidthFTNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthFT = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) WidthMeters(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) WidthMetersFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthMeters = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetWidthMeters() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthMeters = 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) RandomWidthMeters(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWidthMetersNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.WidthMeters = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Zone(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) ZoneFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetZone() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Zone2(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) Zone2Func(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetZone2() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetCreatedDate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) CreatedUser(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetCreatedUser() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) GeometryX(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetGeometryX() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) GeometryY(val null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetGeometryY() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) LastEditedDate(val null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastEditedDate() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) LastEditedUser(val null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetLastEditedUser() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLinelocationMods) Version(val int32) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) VersionFunc(f func() int32) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetVersion() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyLinelocationMods) RandomVersion(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyLinelocationMods) WithParentsCascading() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { + if isDone, _ := historyLinelocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyLinelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyLinelocationMods) WithOrganization(rel *OrganizationTemplate) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { + o.r.Organization = &historyLinelocationROrganizationR{ + o: rel, + } + }) +} + +func (m historyLinelocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyLinelocationMods) WithExistingOrganization(em *models.Organization) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { + o.r.Organization = &historyLinelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyLinelocationMods) WithoutOrganization() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_locationtracking.bob.go b/factory/history_locationtracking.bob.go new file mode 100644 index 00000000..992c40ef --- /dev/null +++ b/factory/history_locationtracking.bob.go @@ -0,0 +1,1239 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryLocationtrackingMod interface { + Apply(context.Context, *HistoryLocationtrackingTemplate) +} + +type HistoryLocationtrackingModFunc func(context.Context, *HistoryLocationtrackingTemplate) + +func (f HistoryLocationtrackingModFunc) Apply(ctx context.Context, n *HistoryLocationtrackingTemplate) { + f(ctx, n) +} + +type HistoryLocationtrackingModSlice []HistoryLocationtrackingMod + +func (mods HistoryLocationtrackingModSlice) Apply(ctx context.Context, n *HistoryLocationtrackingTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accuracy func() null.Val[float64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Objectid func() int32 + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyLocationtrackingR + f *Factory + + alreadyPersisted bool +} + +type historyLocationtrackingR struct { + Organization *historyLocationtrackingROrganizationR +} + +type historyLocationtrackingROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryLocationtrackingTemplate +func (o *HistoryLocationtrackingTemplate) Apply(ctx context.Context, mods ...HistoryLocationtrackingMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryLocationtracking +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryLocationtrackingTemplate) setModelRels(o *models.HistoryLocationtracking) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryLocationtrackingSetter +// this does nothing with the relationship templates +func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtrackingSetter { + m := &models.HistoryLocationtrackingSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accuracy != nil { + val := o.Accuracy() + m.Accuracy = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryLocationtrackingSetter +// this does nothing with the relationship templates +func (o HistoryLocationtrackingTemplate) BuildManySetter(number int) []*models.HistoryLocationtrackingSetter { + m := make([]*models.HistoryLocationtrackingSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryLocationtracking +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryLocationtrackingTemplate.Create +func (o HistoryLocationtrackingTemplate) Build() *models.HistoryLocationtracking { + m := &models.HistoryLocationtracking{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accuracy != nil { + m.Accuracy = o.Accuracy() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryLocationtrackingSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryLocationtrackingTemplate.CreateMany +func (o HistoryLocationtrackingTemplate) BuildMany(number int) models.HistoryLocationtrackingSlice { + m := make(models.HistoryLocationtrackingSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryLocationtracking +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyLocationtracking and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryLocationtrackingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryLocationtracking, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryLocationtracking(opt) + + m, err := models.HistoryLocationtrackings.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyLocationtracking and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryLocationtrackingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryLocationtracking { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyLocationtracking 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 *HistoryLocationtrackingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryLocationtracking { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyLocationtrackings and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryLocationtrackingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryLocationtrackingSlice, error) { + var err error + m := make(models.HistoryLocationtrackingSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyLocationtrackings and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryLocationtrackingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryLocationtrackingSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyLocationtrackings 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 HistoryLocationtrackingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryLocationtrackingSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryLocationtracking has methods that act as mods for the HistoryLocationtrackingTemplate +var HistoryLocationtrackingMods historyLocationtrackingMods + +type historyLocationtrackingMods struct{} + +func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModSlice{ + HistoryLocationtrackingMods.RandomOrganizationID(f), + HistoryLocationtrackingMods.RandomAccuracy(f), + HistoryLocationtrackingMods.RandomCreationdate(f), + HistoryLocationtrackingMods.RandomCreator(f), + HistoryLocationtrackingMods.RandomEditdate(f), + HistoryLocationtrackingMods.RandomEditor(f), + HistoryLocationtrackingMods.RandomFieldtech(f), + HistoryLocationtrackingMods.RandomGlobalid(f), + HistoryLocationtrackingMods.RandomObjectid(f), + HistoryLocationtrackingMods.RandomCreatedDate(f), + HistoryLocationtrackingMods.RandomCreatedUser(f), + HistoryLocationtrackingMods.RandomGeometryX(f), + HistoryLocationtrackingMods.RandomGeometryY(f), + HistoryLocationtrackingMods.RandomLastEditedDate(f), + HistoryLocationtrackingMods.RandomLastEditedUser(f), + HistoryLocationtrackingMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) OrganizationID(val null.Val[int32]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetOrganizationID() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Accuracy(val null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) AccuracyFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Accuracy = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetAccuracy() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Accuracy = 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) RandomAccuracy(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAccuracyNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Accuracy = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Creationdate(val null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) CreationdateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetCreationdate() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Creator(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) CreatorFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetCreator() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Editdate(val null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) EditdateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetEditdate() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Editor(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) EditorFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetEditor() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Fieldtech(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) FieldtechFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetFieldtech() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Globalid(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) GlobalidFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetGlobalid() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Objectid(val int32) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) ObjectidFunc(f func() int32) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetObjectid() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyLocationtrackingMods) RandomObjectid(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) CreatedDate(val null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) CreatedDateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetCreatedDate() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) CreatedUser(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) CreatedUserFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetCreatedUser() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) GeometryX(val null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) GeometryXFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetGeometryX() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) GeometryY(val null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) GeometryYFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetGeometryY() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) LastEditedDate(val null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetLastEditedDate() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) LastEditedUser(val null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) LastEditedUserFunc(f func() null.Val[string]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetLastEditedUser() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyLocationtrackingMods) Version(val int32) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) VersionFunc(f func() int32) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetVersion() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyLocationtrackingMods) RandomVersion(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyLocationtrackingMods) WithParentsCascading() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { + if isDone, _ := historyLocationtrackingWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyLocationtrackingWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyLocationtrackingMods) WithOrganization(rel *OrganizationTemplate) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { + o.r.Organization = &historyLocationtrackingROrganizationR{ + o: rel, + } + }) +} + +func (m historyLocationtrackingMods) WithNewOrganization(mods ...OrganizationMod) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyLocationtrackingMods) WithExistingOrganization(em *models.Organization) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { + o.r.Organization = &historyLocationtrackingROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyLocationtrackingMods) WithoutOrganization() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_mosquitoinspection.bob.go b/factory/history_mosquitoinspection.bob.go new file mode 100644 index 00000000..1d333283 --- /dev/null +++ b/factory/history_mosquitoinspection.bob.go @@ -0,0 +1,4029 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryMosquitoinspectionMod interface { + Apply(context.Context, *HistoryMosquitoinspectionTemplate) +} + +type HistoryMosquitoinspectionModFunc func(context.Context, *HistoryMosquitoinspectionTemplate) + +func (f HistoryMosquitoinspectionModFunc) Apply(ctx context.Context, n *HistoryMosquitoinspectionTemplate) { + f(ctx, n) +} + +type HistoryMosquitoinspectionModSlice []HistoryMosquitoinspectionMod + +func (mods HistoryMosquitoinspectionModSlice) Apply(ctx context.Context, n *HistoryMosquitoinspectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Actiontaken func() null.Val[string] + Activity func() null.Val[string] + Adultact func() null.Val[string] + Avetemp func() null.Val[float64] + Avglarvae func() null.Val[float64] + Avgpupae func() null.Val[float64] + Breeding func() null.Val[string] + Cbcount func() null.Val[int16] + Comments func() null.Val[string] + Containercount func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Domstage func() null.Val[string] + Eggs func() null.Val[int16] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldspecies func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Jurisdiction func() null.Val[string] + Larvaepresent func() null.Val[int16] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Lstages func() null.Val[string] + Numdips func() null.Val[int16] + Objectid func() int32 + Personalcontact func() null.Val[int16] + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Posdips func() null.Val[int16] + Positivecontainercount func() null.Val[int16] + Pupaepresent func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sdid func() null.Val[string] + Sitecond func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Tirecount func() null.Val[int16] + Totlarvae func() null.Val[int16] + Totpupae func() null.Val[int16] + Visualmonitoring func() null.Val[int16] + Vmcomments func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Adminaction func() null.Val[string] + Ptaid func() null.Val[string] + Version func() int32 + + r historyMosquitoinspectionR + f *Factory + + alreadyPersisted bool +} + +type historyMosquitoinspectionR struct { + Organization *historyMosquitoinspectionROrganizationR +} + +type historyMosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryMosquitoinspectionTemplate +func (o *HistoryMosquitoinspectionTemplate) Apply(ctx context.Context, mods ...HistoryMosquitoinspectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryMosquitoinspection +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryMosquitoinspectionTemplate) setModelRels(o *models.HistoryMosquitoinspection) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryMosquitoinspectionSetter +// this does nothing with the relationship templates +func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquitoinspectionSetter { + m := &models.HistoryMosquitoinspectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Actiontaken != nil { + val := o.Actiontaken() + m.Actiontaken = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Adultact != nil { + val := o.Adultact() + m.Adultact = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Avglarvae != nil { + val := o.Avglarvae() + m.Avglarvae = omitnull.FromNull(val) + } + if o.Avgpupae != nil { + val := o.Avgpupae() + m.Avgpupae = omitnull.FromNull(val) + } + if o.Breeding != nil { + val := o.Breeding() + m.Breeding = omitnull.FromNull(val) + } + if o.Cbcount != nil { + val := o.Cbcount() + m.Cbcount = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Containercount != nil { + val := o.Containercount() + m.Containercount = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Domstage != nil { + val := o.Domstage() + m.Domstage = omitnull.FromNull(val) + } + if o.Eggs != nil { + val := o.Eggs() + m.Eggs = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldspecies != nil { + val := o.Fieldspecies() + m.Fieldspecies = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvaepresent != nil { + val := o.Larvaepresent() + m.Larvaepresent = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Lstages != nil { + val := o.Lstages() + m.Lstages = omitnull.FromNull(val) + } + if o.Numdips != nil { + val := o.Numdips() + m.Numdips = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Personalcontact != nil { + val := o.Personalcontact() + m.Personalcontact = omitnull.FromNull(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Posdips != nil { + val := o.Posdips() + m.Posdips = omitnull.FromNull(val) + } + if o.Positivecontainercount != nil { + val := o.Positivecontainercount() + m.Positivecontainercount = omitnull.FromNull(val) + } + if o.Pupaepresent != nil { + val := o.Pupaepresent() + m.Pupaepresent = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sdid != nil { + val := o.Sdid() + m.Sdid = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Tirecount != nil { + val := o.Tirecount() + m.Tirecount = omitnull.FromNull(val) + } + if o.Totlarvae != nil { + val := o.Totlarvae() + m.Totlarvae = omitnull.FromNull(val) + } + if o.Totpupae != nil { + val := o.Totpupae() + m.Totpupae = omitnull.FromNull(val) + } + if o.Visualmonitoring != nil { + val := o.Visualmonitoring() + m.Visualmonitoring = omitnull.FromNull(val) + } + if o.Vmcomments != nil { + val := o.Vmcomments() + m.Vmcomments = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Adminaction != nil { + val := o.Adminaction() + m.Adminaction = omitnull.FromNull(val) + } + if o.Ptaid != nil { + val := o.Ptaid() + m.Ptaid = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryMosquitoinspectionSetter +// this does nothing with the relationship templates +func (o HistoryMosquitoinspectionTemplate) BuildManySetter(number int) []*models.HistoryMosquitoinspectionSetter { + m := make([]*models.HistoryMosquitoinspectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryMosquitoinspection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryMosquitoinspectionTemplate.Create +func (o HistoryMosquitoinspectionTemplate) Build() *models.HistoryMosquitoinspection { + m := &models.HistoryMosquitoinspection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Actiontaken != nil { + m.Actiontaken = o.Actiontaken() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Adultact != nil { + m.Adultact = o.Adultact() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Avglarvae != nil { + m.Avglarvae = o.Avglarvae() + } + if o.Avgpupae != nil { + m.Avgpupae = o.Avgpupae() + } + if o.Breeding != nil { + m.Breeding = o.Breeding() + } + if o.Cbcount != nil { + m.Cbcount = o.Cbcount() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Containercount != nil { + m.Containercount = o.Containercount() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Domstage != nil { + m.Domstage = o.Domstage() + } + if o.Eggs != nil { + m.Eggs = o.Eggs() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldspecies != nil { + m.Fieldspecies = o.Fieldspecies() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvaepresent != nil { + m.Larvaepresent = o.Larvaepresent() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Lstages != nil { + m.Lstages = o.Lstages() + } + if o.Numdips != nil { + m.Numdips = o.Numdips() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Personalcontact != nil { + m.Personalcontact = o.Personalcontact() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Posdips != nil { + m.Posdips = o.Posdips() + } + if o.Positivecontainercount != nil { + m.Positivecontainercount = o.Positivecontainercount() + } + if o.Pupaepresent != nil { + m.Pupaepresent = o.Pupaepresent() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sdid != nil { + m.Sdid = o.Sdid() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Tirecount != nil { + m.Tirecount = o.Tirecount() + } + if o.Totlarvae != nil { + m.Totlarvae = o.Totlarvae() + } + if o.Totpupae != nil { + m.Totpupae = o.Totpupae() + } + if o.Visualmonitoring != nil { + m.Visualmonitoring = o.Visualmonitoring() + } + if o.Vmcomments != nil { + m.Vmcomments = o.Vmcomments() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Adminaction != nil { + m.Adminaction = o.Adminaction() + } + if o.Ptaid != nil { + m.Ptaid = o.Ptaid() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryMosquitoinspectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryMosquitoinspectionTemplate.CreateMany +func (o HistoryMosquitoinspectionTemplate) BuildMany(number int) models.HistoryMosquitoinspectionSlice { + m := make(models.HistoryMosquitoinspectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryMosquitoinspection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyMosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryMosquitoinspection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryMosquitoinspection(opt) + + m, err := models.HistoryMosquitoinspections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyMosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryMosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryMosquitoinspection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyMosquitoinspection 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 *HistoryMosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryMosquitoinspection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyMosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryMosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryMosquitoinspectionSlice, error) { + var err error + m := make(models.HistoryMosquitoinspectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyMosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryMosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryMosquitoinspectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyMosquitoinspections 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 HistoryMosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryMosquitoinspectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryMosquitoinspection has methods that act as mods for the HistoryMosquitoinspectionTemplate +var HistoryMosquitoinspectionMods historyMosquitoinspectionMods + +type historyMosquitoinspectionMods struct{} + +func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModSlice{ + HistoryMosquitoinspectionMods.RandomOrganizationID(f), + HistoryMosquitoinspectionMods.RandomActiontaken(f), + HistoryMosquitoinspectionMods.RandomActivity(f), + HistoryMosquitoinspectionMods.RandomAdultact(f), + HistoryMosquitoinspectionMods.RandomAvetemp(f), + HistoryMosquitoinspectionMods.RandomAvglarvae(f), + HistoryMosquitoinspectionMods.RandomAvgpupae(f), + HistoryMosquitoinspectionMods.RandomBreeding(f), + HistoryMosquitoinspectionMods.RandomCbcount(f), + HistoryMosquitoinspectionMods.RandomComments(f), + HistoryMosquitoinspectionMods.RandomContainercount(f), + HistoryMosquitoinspectionMods.RandomCreationdate(f), + HistoryMosquitoinspectionMods.RandomCreator(f), + HistoryMosquitoinspectionMods.RandomDomstage(f), + HistoryMosquitoinspectionMods.RandomEggs(f), + HistoryMosquitoinspectionMods.RandomEnddatetime(f), + HistoryMosquitoinspectionMods.RandomEditdate(f), + HistoryMosquitoinspectionMods.RandomEditor(f), + HistoryMosquitoinspectionMods.RandomFieldspecies(f), + HistoryMosquitoinspectionMods.RandomFieldtech(f), + HistoryMosquitoinspectionMods.RandomGlobalid(f), + HistoryMosquitoinspectionMods.RandomJurisdiction(f), + HistoryMosquitoinspectionMods.RandomLarvaepresent(f), + HistoryMosquitoinspectionMods.RandomLinelocid(f), + HistoryMosquitoinspectionMods.RandomLocationname(f), + HistoryMosquitoinspectionMods.RandomLstages(f), + HistoryMosquitoinspectionMods.RandomNumdips(f), + HistoryMosquitoinspectionMods.RandomObjectid(f), + HistoryMosquitoinspectionMods.RandomPersonalcontact(f), + HistoryMosquitoinspectionMods.RandomPointlocid(f), + HistoryMosquitoinspectionMods.RandomPolygonlocid(f), + HistoryMosquitoinspectionMods.RandomPosdips(f), + HistoryMosquitoinspectionMods.RandomPositivecontainercount(f), + HistoryMosquitoinspectionMods.RandomPupaepresent(f), + HistoryMosquitoinspectionMods.RandomRaingauge(f), + HistoryMosquitoinspectionMods.RandomRecordstatus(f), + HistoryMosquitoinspectionMods.RandomReviewed(f), + HistoryMosquitoinspectionMods.RandomReviewedby(f), + HistoryMosquitoinspectionMods.RandomRevieweddate(f), + HistoryMosquitoinspectionMods.RandomSdid(f), + HistoryMosquitoinspectionMods.RandomSitecond(f), + HistoryMosquitoinspectionMods.RandomSrid(f), + HistoryMosquitoinspectionMods.RandomStartdatetime(f), + HistoryMosquitoinspectionMods.RandomTirecount(f), + HistoryMosquitoinspectionMods.RandomTotlarvae(f), + HistoryMosquitoinspectionMods.RandomTotpupae(f), + HistoryMosquitoinspectionMods.RandomVisualmonitoring(f), + HistoryMosquitoinspectionMods.RandomVmcomments(f), + HistoryMosquitoinspectionMods.RandomWinddir(f), + HistoryMosquitoinspectionMods.RandomWindspeed(f), + HistoryMosquitoinspectionMods.RandomZone(f), + HistoryMosquitoinspectionMods.RandomZone2(f), + HistoryMosquitoinspectionMods.RandomCreatedDate(f), + HistoryMosquitoinspectionMods.RandomCreatedUser(f), + HistoryMosquitoinspectionMods.RandomGeometryX(f), + HistoryMosquitoinspectionMods.RandomGeometryY(f), + HistoryMosquitoinspectionMods.RandomLastEditedDate(f), + HistoryMosquitoinspectionMods.RandomLastEditedUser(f), + HistoryMosquitoinspectionMods.RandomAdminaction(f), + HistoryMosquitoinspectionMods.RandomPtaid(f), + HistoryMosquitoinspectionMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) OrganizationID(val null.Val[int32]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetOrganizationID() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Actiontaken(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Actiontaken = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetActiontaken() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Actiontaken = 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) RandomActiontaken(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActiontakenNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Activity(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetActivity() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Activity = 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) RandomActivity(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Adultact(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adultact = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetAdultact() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adultact = 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) RandomAdultact(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAdultactNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adultact = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Avetemp(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetAvetemp() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avetemp = 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) RandomAvetemp(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Avglarvae(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) AvglarvaeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avglarvae = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetAvglarvae() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avglarvae = 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) RandomAvglarvae(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvglarvaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Avgpupae(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) AvgpupaeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avgpupae = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetAvgpupae() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avgpupae = 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) RandomAvgpupae(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvgpupaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Avgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Breeding(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Breeding = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetBreeding() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Breeding = 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) RandomBreeding(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBreedingNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Breeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Cbcount(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CbcountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Cbcount = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCbcount() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Cbcount = 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) RandomCbcount(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Comments(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetComments() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Containercount(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ContainercountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Containercount = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetContainercount() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Containercount = 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) RandomContainercount(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Creationdate(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCreationdate() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Creator(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCreator() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Domstage(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Domstage = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetDomstage() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Domstage = 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) RandomDomstage(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDomstageNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Domstage = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Eggs(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) EggsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Eggs = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetEggs() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Eggs = 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) RandomEggs(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomEggsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Enddatetime(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetEnddatetime() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Enddatetime = 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) RandomEnddatetime(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Editdate(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetEditdate() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Editor(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) EditorFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetEditor() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Fieldspecies(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldspecies = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetFieldspecies() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldspecies = 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) RandomFieldspecies(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldspeciesNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Fieldtech(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetFieldtech() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Globalid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetGlobalid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Jurisdiction(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) JurisdictionFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetJurisdiction() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Jurisdiction = 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) RandomJurisdiction(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Larvaepresent = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLarvaepresent() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Larvaepresent = 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) RandomLarvaepresent(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Linelocid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLinelocid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Linelocid = 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) RandomLinelocid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Locationname(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLocationname() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Lstages(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LstagesFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Lstages = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLstages() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Lstages = 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) RandomLstages(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLstagesNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Lstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Numdips(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) NumdipsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Numdips = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetNumdips() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Numdips = 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) RandomNumdips(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNumdipsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Numdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Objectid(val int32) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ObjectidFunc(f func() int32) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetObjectid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyMosquitoinspectionMods) RandomObjectid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Personalcontact(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Personalcontact = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPersonalcontact() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Personalcontact = 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) RandomPersonalcontact(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPersonalcontactNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Personalcontact = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Pointlocid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPointlocid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pointlocid = 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) RandomPointlocid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Polygonlocid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPolygonlocid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Polygonlocid = 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) RandomPolygonlocid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Posdips(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Posdips = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPosdips() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Posdips = 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) RandomPosdips(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Positivecontainercount(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PositivecontainercountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Positivecontainercount = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPositivecontainercount() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Positivecontainercount = 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) RandomPositivecontainercount(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPositivecontainercountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Positivecontainercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pupaepresent = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPupaepresent() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pupaepresent = 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) RandomPupaepresent(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPupaepresentNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Pupaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Raingauge(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetRaingauge() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Raingauge = 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) RandomRaingauge(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Recordstatus(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetRecordstatus() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Recordstatus = 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) RandomRecordstatus(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Reviewed(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetReviewed() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewed = 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) RandomReviewed(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Reviewedby(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetReviewedby() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewedby = 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) RandomReviewedby(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Revieweddate(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetRevieweddate() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Revieweddate = 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) RandomRevieweddate(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Sdid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) SdidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sdid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetSdid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sdid = 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) RandomSdid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSdidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Sitecond(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetSitecond() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sitecond = 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) RandomSitecond(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Srid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) SridFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetSrid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Srid = 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) RandomSrid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Startdatetime(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetStartdatetime() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Startdatetime = 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) RandomStartdatetime(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Tirecount(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) TirecountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Tirecount = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetTirecount() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Tirecount = 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) RandomTirecount(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Totlarvae(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) TotlarvaeFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totlarvae = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetTotlarvae() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totlarvae = 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) RandomTotlarvae(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTotlarvaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totlarvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Totpupae(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) TotpupaeFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totpupae = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetTotpupae() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totpupae = 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) RandomTotpupae(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTotpupaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Totpupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Visualmonitoring = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetVisualmonitoring() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Visualmonitoring = 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) RandomVisualmonitoring(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomVisualmonitoringNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Visualmonitoring = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Vmcomments(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) VmcommentsFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Vmcomments = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetVmcomments() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Vmcomments = 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) RandomVmcomments(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVmcommentsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Vmcomments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Winddir(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetWinddir() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Winddir = 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) RandomWinddir(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Windspeed(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetWindspeed() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Windspeed = 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) RandomWindspeed(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Zone(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetZone() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Zone2(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) Zone2Func(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetZone2() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCreatedDate() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) CreatedUser(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCreatedUser() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) GeometryX(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetGeometryX() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) GeometryY(val null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetGeometryY() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) LastEditedDate(val null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLastEditedDate() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) LastEditedUser(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetLastEditedUser() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Adminaction(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adminaction = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetAdminaction() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adminaction = 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) RandomAdminaction(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAdminactionNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Adminaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Ptaid(val null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) PtaidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Ptaid = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetPtaid() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Ptaid = 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) RandomPtaid(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPtaidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Version(val int32) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) VersionFunc(f func() int32) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetVersion() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyMosquitoinspectionMods) RandomVersion(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyMosquitoinspectionMods) WithParentsCascading() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { + if isDone, _ := historyMosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyMosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyMosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { + o.r.Organization = &historyMosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m historyMosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyMosquitoinspectionMods) WithExistingOrganization(em *models.Organization) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { + o.r.Organization = &historyMosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyMosquitoinspectionMods) WithoutOrganization() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_pointlocation.bob.go b/factory/history_pointlocation.bob.go new file mode 100644 index 00000000..e5f6c1b5 --- /dev/null +++ b/factory/history_pointlocation.bob.go @@ -0,0 +1,3223 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryPointlocationMod interface { + Apply(context.Context, *HistoryPointlocationTemplate) +} + +type HistoryPointlocationModFunc func(context.Context, *HistoryPointlocationTemplate) + +func (f HistoryPointlocationModFunc) Apply(ctx context.Context, n *HistoryPointlocationTemplate) { + f(ctx, n) +} + +type HistoryPointlocationModSlice []HistoryPointlocationMod + +func (mods HistoryPointlocationModSlice) Apply(ctx context.Context, n *HistoryPointlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Stype func() null.Val[string] + Symbology func() null.Val[string] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + X func() null.Val[float64] + Y func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Assignedtech func() null.Val[string] + DeactivateReason func() null.Val[string] + Scalarpriority func() null.Val[int64] + Sourcestatus func() null.Val[string] + Version func() int32 + + r historyPointlocationR + f *Factory + + alreadyPersisted bool +} + +type historyPointlocationR struct { + Organization *historyPointlocationROrganizationR +} + +type historyPointlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryPointlocationTemplate +func (o *HistoryPointlocationTemplate) Apply(ctx context.Context, mods ...HistoryPointlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryPointlocation +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryPointlocationTemplate) setModelRels(o *models.HistoryPointlocation) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryPointlocationSetter +// this does nothing with the relationship templates +func (o HistoryPointlocationTemplate) BuildSetter() *models.HistoryPointlocationSetter { + m := &models.HistoryPointlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Stype != nil { + val := o.Stype() + m.Stype = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.X != nil { + val := o.X() + m.X = omitnull.FromNull(val) + } + if o.Y != nil { + val := o.Y() + m.Y = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Assignedtech != nil { + val := o.Assignedtech() + m.Assignedtech = omitnull.FromNull(val) + } + if o.DeactivateReason != nil { + val := o.DeactivateReason() + m.DeactivateReason = omitnull.FromNull(val) + } + if o.Scalarpriority != nil { + val := o.Scalarpriority() + m.Scalarpriority = omitnull.FromNull(val) + } + if o.Sourcestatus != nil { + val := o.Sourcestatus() + m.Sourcestatus = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryPointlocationSetter +// this does nothing with the relationship templates +func (o HistoryPointlocationTemplate) BuildManySetter(number int) []*models.HistoryPointlocationSetter { + m := make([]*models.HistoryPointlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryPointlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPointlocationTemplate.Create +func (o HistoryPointlocationTemplate) Build() *models.HistoryPointlocation { + m := &models.HistoryPointlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Stype != nil { + m.Stype = o.Stype() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.X != nil { + m.X = o.X() + } + if o.Y != nil { + m.Y = o.Y() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Assignedtech != nil { + m.Assignedtech = o.Assignedtech() + } + if o.DeactivateReason != nil { + m.DeactivateReason = o.DeactivateReason() + } + if o.Scalarpriority != nil { + m.Scalarpriority = o.Scalarpriority() + } + if o.Sourcestatus != nil { + m.Sourcestatus = o.Sourcestatus() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryPointlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPointlocationTemplate.CreateMany +func (o HistoryPointlocationTemplate) BuildMany(number int) models.HistoryPointlocationSlice { + m := make(models.HistoryPointlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryPointlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyPointlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPointlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryPointlocation(opt) + + m, err := models.HistoryPointlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyPointlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryPointlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPointlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyPointlocation 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 *HistoryPointlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPointlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyPointlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryPointlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPointlocationSlice, error) { + var err error + m := make(models.HistoryPointlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyPointlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryPointlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPointlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyPointlocations 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 HistoryPointlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPointlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryPointlocation has methods that act as mods for the HistoryPointlocationTemplate +var HistoryPointlocationMods historyPointlocationMods + +type historyPointlocationMods struct{} + +func (m historyPointlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModSlice{ + HistoryPointlocationMods.RandomOrganizationID(f), + HistoryPointlocationMods.RandomAccessdesc(f), + HistoryPointlocationMods.RandomActive(f), + HistoryPointlocationMods.RandomComments(f), + HistoryPointlocationMods.RandomCreationdate(f), + HistoryPointlocationMods.RandomCreator(f), + HistoryPointlocationMods.RandomDescription(f), + HistoryPointlocationMods.RandomExternalid(f), + HistoryPointlocationMods.RandomEditdate(f), + HistoryPointlocationMods.RandomEditor(f), + HistoryPointlocationMods.RandomGlobalid(f), + HistoryPointlocationMods.RandomHabitat(f), + HistoryPointlocationMods.RandomJurisdiction(f), + HistoryPointlocationMods.RandomLarvinspectinterval(f), + HistoryPointlocationMods.RandomLastinspectactiontaken(f), + HistoryPointlocationMods.RandomLastinspectactivity(f), + HistoryPointlocationMods.RandomLastinspectavglarvae(f), + HistoryPointlocationMods.RandomLastinspectavgpupae(f), + HistoryPointlocationMods.RandomLastinspectbreeding(f), + HistoryPointlocationMods.RandomLastinspectconditions(f), + HistoryPointlocationMods.RandomLastinspectdate(f), + HistoryPointlocationMods.RandomLastinspectfieldspecies(f), + HistoryPointlocationMods.RandomLastinspectlstages(f), + HistoryPointlocationMods.RandomLasttreatactivity(f), + HistoryPointlocationMods.RandomLasttreatdate(f), + HistoryPointlocationMods.RandomLasttreatproduct(f), + HistoryPointlocationMods.RandomLasttreatqty(f), + HistoryPointlocationMods.RandomLasttreatqtyunit(f), + HistoryPointlocationMods.RandomLocationnumber(f), + HistoryPointlocationMods.RandomName(f), + HistoryPointlocationMods.RandomNextactiondatescheduled(f), + HistoryPointlocationMods.RandomObjectid(f), + HistoryPointlocationMods.RandomPriority(f), + HistoryPointlocationMods.RandomStype(f), + HistoryPointlocationMods.RandomSymbology(f), + HistoryPointlocationMods.RandomUsetype(f), + HistoryPointlocationMods.RandomWaterorigin(f), + HistoryPointlocationMods.RandomX(f), + HistoryPointlocationMods.RandomY(f), + HistoryPointlocationMods.RandomZone(f), + HistoryPointlocationMods.RandomZone2(f), + HistoryPointlocationMods.RandomGeometryX(f), + HistoryPointlocationMods.RandomGeometryY(f), + HistoryPointlocationMods.RandomAssignedtech(f), + HistoryPointlocationMods.RandomDeactivateReason(f), + HistoryPointlocationMods.RandomScalarpriority(f), + HistoryPointlocationMods.RandomSourcestatus(f), + HistoryPointlocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyPointlocationMods) OrganizationID(val null.Val[int32]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetOrganizationID() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Accessdesc(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetAccessdesc() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Accessdesc = 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 historyPointlocationMods) RandomAccessdesc(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Active(val null.Val[int16]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetActive() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Active = 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 historyPointlocationMods) RandomActive(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Comments(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) CommentsFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetComments() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Comments = 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 historyPointlocationMods) RandomComments(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Creationdate(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetCreationdate() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creationdate = 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 historyPointlocationMods) RandomCreationdate(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Creator(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) CreatorFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetCreator() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creator = 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 historyPointlocationMods) RandomCreator(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Description(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetDescription() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Description = 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 historyPointlocationMods) RandomDescription(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Externalid(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetExternalid() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Externalid = 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 historyPointlocationMods) RandomExternalid(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Editdate(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetEditdate() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editdate = 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 historyPointlocationMods) RandomEditdate(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Editor(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) EditorFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetEditor() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editor = 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 historyPointlocationMods) RandomEditor(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Globalid(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetGlobalid() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Globalid = 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 historyPointlocationMods) RandomGlobalid(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Habitat(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) HabitatFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetHabitat() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Habitat = 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 historyPointlocationMods) RandomHabitat(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Jurisdiction(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetJurisdiction() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Jurisdiction = 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 historyPointlocationMods) RandomJurisdiction(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Larvinspectinterval(val null.Val[int16]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLarvinspectinterval() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Larvinspectinterval = 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 historyPointlocationMods) RandomLarvinspectinterval(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectactiontaken() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactiontaken = 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 historyPointlocationMods) RandomLastinspectactiontaken(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectactivity(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectactivity() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactivity = 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 historyPointlocationMods) RandomLastinspectactivity(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectavglarvae() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavglarvae = 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 historyPointlocationMods) RandomLastinspectavglarvae(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectavgpupae() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavgpupae = 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 historyPointlocationMods) RandomLastinspectavgpupae(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectbreeding(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectbreeding() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectbreeding = 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 historyPointlocationMods) RandomLastinspectbreeding(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectconditions(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectconditions() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectconditions = 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 historyPointlocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectdate(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectdate() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectdate = 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 historyPointlocationMods) RandomLastinspectdate(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectfieldspecies() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectfieldspecies = 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 historyPointlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lastinspectlstages(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLastinspectlstages() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectlstages = 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 historyPointlocationMods) RandomLastinspectlstages(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lasttreatactivity(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLasttreatactivity() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatactivity = 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 historyPointlocationMods) RandomLasttreatactivity(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lasttreatdate(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLasttreatdate() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatdate = 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 historyPointlocationMods) RandomLasttreatdate(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lasttreatproduct(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLasttreatproduct() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatproduct = 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 historyPointlocationMods) RandomLasttreatproduct(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lasttreatqty(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLasttreatqty() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqty = 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 historyPointlocationMods) RandomLasttreatqty(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLasttreatqtyunit() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqtyunit = 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 historyPointlocationMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Locationnumber(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetLocationnumber() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Locationnumber = 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 historyPointlocationMods) RandomLocationnumber(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Name(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) NameFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetName() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Name = 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 historyPointlocationMods) RandomName(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetNextactiondatescheduled() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Nextactiondatescheduled = 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 historyPointlocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Objectid(val int32) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) ObjectidFunc(f func() int32) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetObjectid() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPointlocationMods) RandomObjectid(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Priority(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) PriorityFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetPriority() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Priority = 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 historyPointlocationMods) RandomPriority(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Stype(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Stype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) StypeFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Stype = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetStype() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Stype = 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 historyPointlocationMods) RandomStype(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Stype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomStypeNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Stype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Symbology(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetSymbology() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Symbology = 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 historyPointlocationMods) RandomSymbology(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Usetype(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetUsetype() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Usetype = 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 historyPointlocationMods) RandomUsetype(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Waterorigin(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) WateroriginFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetWaterorigin() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Waterorigin = 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 historyPointlocationMods) RandomWaterorigin(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) X(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.X = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) XFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.X = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetX() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.X = 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 historyPointlocationMods) RandomX(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.X = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomXNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.X = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Y(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Y = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) YFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Y = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetY() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Y = 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 historyPointlocationMods) RandomY(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Y = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomYNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Y = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Zone(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) ZoneFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetZone() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone = 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 historyPointlocationMods) RandomZone(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Zone2(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) Zone2Func(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetZone2() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone2 = 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 historyPointlocationMods) RandomZone2(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) GeometryX(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetGeometryX() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryX = 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 historyPointlocationMods) RandomGeometryX(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) GeometryY(val null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetGeometryY() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryY = 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 historyPointlocationMods) RandomGeometryY(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Assignedtech(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) AssignedtechFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Assignedtech = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetAssignedtech() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Assignedtech = 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 historyPointlocationMods) RandomAssignedtech(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAssignedtechNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) DeactivateReason(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.DeactivateReason = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetDeactivateReason() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.DeactivateReason = 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 historyPointlocationMods) RandomDeactivateReason(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDeactivateReasonNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.DeactivateReason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Scalarpriority(val null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) ScalarpriorityFunc(f func() null.Val[int64]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Scalarpriority = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetScalarpriority() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Scalarpriority = 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 historyPointlocationMods) RandomScalarpriority(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomScalarpriorityNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Scalarpriority = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Sourcestatus(val null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) SourcestatusFunc(f func() null.Val[string]) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Sourcestatus = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetSourcestatus() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Sourcestatus = 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 historyPointlocationMods) RandomSourcestatus(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourcestatusNotNull(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Sourcestatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPointlocationMods) Version(val int32) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPointlocationMods) VersionFunc(f func() int32) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyPointlocationMods) UnsetVersion() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPointlocationMods) RandomVersion(f *faker.Faker) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyPointlocationMods) WithParentsCascading() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { + if isDone, _ := historyPointlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyPointlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyPointlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { + o.r.Organization = &historyPointlocationROrganizationR{ + o: rel, + } + }) +} + +func (m historyPointlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyPointlocationMods) WithExistingOrganization(em *models.Organization) HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { + o.r.Organization = &historyPointlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyPointlocationMods) WithoutOrganization() HistoryPointlocationMod { + return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_polygonlocation.bob.go b/factory/history_polygonlocation.bob.go new file mode 100644 index 00000000..3874cd15 --- /dev/null +++ b/factory/history_polygonlocation.bob.go @@ -0,0 +1,3099 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryPolygonlocationMod interface { + Apply(context.Context, *HistoryPolygonlocationTemplate) +} + +type HistoryPolygonlocationModFunc func(context.Context, *HistoryPolygonlocationTemplate) + +func (f HistoryPolygonlocationModFunc) Apply(ctx context.Context, n *HistoryPolygonlocationTemplate) { + f(ctx, n) +} + +type HistoryPolygonlocationModSlice []HistoryPolygonlocationMod + +func (mods HistoryPolygonlocationModSlice) Apply(ctx context.Context, n *HistoryPolygonlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Acres func() null.Val[float64] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Filter func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Hectares func() null.Val[float64] + Jurisdiction func() null.Val[string] + Larvinspectinterval func() null.Val[int16] + Lastinspectactiontaken func() null.Val[string] + Lastinspectactivity func() null.Val[string] + Lastinspectavglarvae func() null.Val[float64] + Lastinspectavgpupae func() null.Val[float64] + Lastinspectbreeding func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectfieldspecies func() null.Val[string] + Lastinspectlstages func() null.Val[string] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Usetype func() null.Val[string] + Waterorigin func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Version func() int32 + + r historyPolygonlocationR + f *Factory + + alreadyPersisted bool +} + +type historyPolygonlocationR struct { + Organization *historyPolygonlocationROrganizationR +} + +type historyPolygonlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryPolygonlocationTemplate +func (o *HistoryPolygonlocationTemplate) Apply(ctx context.Context, mods ...HistoryPolygonlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryPolygonlocation +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryPolygonlocationTemplate) setModelRels(o *models.HistoryPolygonlocation) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryPolygonlocationSetter +// this does nothing with the relationship templates +func (o HistoryPolygonlocationTemplate) BuildSetter() *models.HistoryPolygonlocationSetter { + m := &models.HistoryPolygonlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Filter != nil { + val := o.Filter() + m.Filter = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Larvinspectinterval != nil { + val := o.Larvinspectinterval() + m.Larvinspectinterval = omitnull.FromNull(val) + } + if o.Lastinspectactiontaken != nil { + val := o.Lastinspectactiontaken() + m.Lastinspectactiontaken = omitnull.FromNull(val) + } + if o.Lastinspectactivity != nil { + val := o.Lastinspectactivity() + m.Lastinspectactivity = omitnull.FromNull(val) + } + if o.Lastinspectavglarvae != nil { + val := o.Lastinspectavglarvae() + m.Lastinspectavglarvae = omitnull.FromNull(val) + } + if o.Lastinspectavgpupae != nil { + val := o.Lastinspectavgpupae() + m.Lastinspectavgpupae = omitnull.FromNull(val) + } + if o.Lastinspectbreeding != nil { + val := o.Lastinspectbreeding() + m.Lastinspectbreeding = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectfieldspecies != nil { + val := o.Lastinspectfieldspecies() + m.Lastinspectfieldspecies = omitnull.FromNull(val) + } + if o.Lastinspectlstages != nil { + val := o.Lastinspectlstages() + m.Lastinspectlstages = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Waterorigin != nil { + val := o.Waterorigin() + m.Waterorigin = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryPolygonlocationSetter +// this does nothing with the relationship templates +func (o HistoryPolygonlocationTemplate) BuildManySetter(number int) []*models.HistoryPolygonlocationSetter { + m := make([]*models.HistoryPolygonlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryPolygonlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPolygonlocationTemplate.Create +func (o HistoryPolygonlocationTemplate) Build() *models.HistoryPolygonlocation { + m := &models.HistoryPolygonlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Filter != nil { + m.Filter = o.Filter() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Larvinspectinterval != nil { + m.Larvinspectinterval = o.Larvinspectinterval() + } + if o.Lastinspectactiontaken != nil { + m.Lastinspectactiontaken = o.Lastinspectactiontaken() + } + if o.Lastinspectactivity != nil { + m.Lastinspectactivity = o.Lastinspectactivity() + } + if o.Lastinspectavglarvae != nil { + m.Lastinspectavglarvae = o.Lastinspectavglarvae() + } + if o.Lastinspectavgpupae != nil { + m.Lastinspectavgpupae = o.Lastinspectavgpupae() + } + if o.Lastinspectbreeding != nil { + m.Lastinspectbreeding = o.Lastinspectbreeding() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectfieldspecies != nil { + m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() + } + if o.Lastinspectlstages != nil { + m.Lastinspectlstages = o.Lastinspectlstages() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Waterorigin != nil { + m.Waterorigin = o.Waterorigin() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryPolygonlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPolygonlocationTemplate.CreateMany +func (o HistoryPolygonlocationTemplate) BuildMany(number int) models.HistoryPolygonlocationSlice { + m := make(models.HistoryPolygonlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryPolygonlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyPolygonlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPolygonlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryPolygonlocation(opt) + + m, err := models.HistoryPolygonlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyPolygonlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryPolygonlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPolygonlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyPolygonlocation 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 *HistoryPolygonlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPolygonlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyPolygonlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryPolygonlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPolygonlocationSlice, error) { + var err error + m := make(models.HistoryPolygonlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyPolygonlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryPolygonlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPolygonlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyPolygonlocations 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 HistoryPolygonlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPolygonlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryPolygonlocation has methods that act as mods for the HistoryPolygonlocationTemplate +var HistoryPolygonlocationMods historyPolygonlocationMods + +type historyPolygonlocationMods struct{} + +func (m historyPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModSlice{ + HistoryPolygonlocationMods.RandomOrganizationID(f), + HistoryPolygonlocationMods.RandomAccessdesc(f), + HistoryPolygonlocationMods.RandomAcres(f), + HistoryPolygonlocationMods.RandomActive(f), + HistoryPolygonlocationMods.RandomComments(f), + HistoryPolygonlocationMods.RandomCreationdate(f), + HistoryPolygonlocationMods.RandomCreator(f), + HistoryPolygonlocationMods.RandomDescription(f), + HistoryPolygonlocationMods.RandomExternalid(f), + HistoryPolygonlocationMods.RandomEditdate(f), + HistoryPolygonlocationMods.RandomEditor(f), + HistoryPolygonlocationMods.RandomFilter(f), + HistoryPolygonlocationMods.RandomGlobalid(f), + HistoryPolygonlocationMods.RandomHabitat(f), + HistoryPolygonlocationMods.RandomHectares(f), + HistoryPolygonlocationMods.RandomJurisdiction(f), + HistoryPolygonlocationMods.RandomLarvinspectinterval(f), + HistoryPolygonlocationMods.RandomLastinspectactiontaken(f), + HistoryPolygonlocationMods.RandomLastinspectactivity(f), + HistoryPolygonlocationMods.RandomLastinspectavglarvae(f), + HistoryPolygonlocationMods.RandomLastinspectavgpupae(f), + HistoryPolygonlocationMods.RandomLastinspectbreeding(f), + HistoryPolygonlocationMods.RandomLastinspectconditions(f), + HistoryPolygonlocationMods.RandomLastinspectdate(f), + HistoryPolygonlocationMods.RandomLastinspectfieldspecies(f), + HistoryPolygonlocationMods.RandomLastinspectlstages(f), + HistoryPolygonlocationMods.RandomLasttreatactivity(f), + HistoryPolygonlocationMods.RandomLasttreatdate(f), + HistoryPolygonlocationMods.RandomLasttreatproduct(f), + HistoryPolygonlocationMods.RandomLasttreatqty(f), + HistoryPolygonlocationMods.RandomLasttreatqtyunit(f), + HistoryPolygonlocationMods.RandomLocationnumber(f), + HistoryPolygonlocationMods.RandomName(f), + HistoryPolygonlocationMods.RandomNextactiondatescheduled(f), + HistoryPolygonlocationMods.RandomObjectid(f), + HistoryPolygonlocationMods.RandomPriority(f), + HistoryPolygonlocationMods.RandomSymbology(f), + HistoryPolygonlocationMods.RandomShapeArea(f), + HistoryPolygonlocationMods.RandomShapeLength(f), + HistoryPolygonlocationMods.RandomUsetype(f), + HistoryPolygonlocationMods.RandomWaterorigin(f), + HistoryPolygonlocationMods.RandomZone(f), + HistoryPolygonlocationMods.RandomZone2(f), + HistoryPolygonlocationMods.RandomGeometryX(f), + HistoryPolygonlocationMods.RandomGeometryY(f), + HistoryPolygonlocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) OrganizationID(val null.Val[int32]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetOrganizationID() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Accessdesc(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetAccessdesc() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Accessdesc = 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 historyPolygonlocationMods) RandomAccessdesc(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Acres(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) AcresFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetAcres() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Acres = 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 historyPolygonlocationMods) RandomAcres(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Active(val null.Val[int16]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetActive() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Active = 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 historyPolygonlocationMods) RandomActive(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Comments(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) CommentsFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetComments() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Comments = 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 historyPolygonlocationMods) RandomComments(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Creationdate(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetCreationdate() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creationdate = 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 historyPolygonlocationMods) RandomCreationdate(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Creator(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) CreatorFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetCreator() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creator = 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 historyPolygonlocationMods) RandomCreator(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Description(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetDescription() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Description = 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 historyPolygonlocationMods) RandomDescription(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Externalid(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetExternalid() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Externalid = 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 historyPolygonlocationMods) RandomExternalid(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Editdate(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetEditdate() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editdate = 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 historyPolygonlocationMods) RandomEditdate(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Editor(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) EditorFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetEditor() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editor = 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 historyPolygonlocationMods) RandomEditor(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Filter(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) FilterFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Filter = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetFilter() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Filter = 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 historyPolygonlocationMods) RandomFilter(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFilterNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Filter = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Globalid(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetGlobalid() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Globalid = 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 historyPolygonlocationMods) RandomGlobalid(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Habitat(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) HabitatFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetHabitat() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Habitat = 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 historyPolygonlocationMods) RandomHabitat(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Hectares(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) HectaresFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetHectares() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Hectares = 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 historyPolygonlocationMods) RandomHectares(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Jurisdiction(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetJurisdiction() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Jurisdiction = 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 historyPolygonlocationMods) RandomJurisdiction(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Larvinspectinterval(val null.Val[int16]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Larvinspectinterval = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLarvinspectinterval() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Larvinspectinterval = 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 historyPolygonlocationMods) RandomLarvinspectinterval(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Larvinspectinterval = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactiontaken = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectactiontaken() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactiontaken = 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 historyPolygonlocationMods) RandomLastinspectactiontaken(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectactivity(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactivity = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectactivity() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactivity = 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 historyPolygonlocationMods) RandomLastinspectactivity(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavglarvae = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectavglarvae() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavglarvae = 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 historyPolygonlocationMods) RandomLastinspectavglarvae(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavglarvae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavgpupae = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectavgpupae() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavgpupae = 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 historyPolygonlocationMods) RandomLastinspectavgpupae(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectavgpupae = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectbreeding(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectbreeding = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectbreeding() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectbreeding = 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 historyPolygonlocationMods) RandomLastinspectbreeding(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectbreeding = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectconditions(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectconditions() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectconditions = 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 historyPolygonlocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectdate(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectdate() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectdate = 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 historyPolygonlocationMods) RandomLastinspectdate(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectfieldspecies = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectfieldspecies() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectfieldspecies = 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 historyPolygonlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectfieldspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lastinspectlstages(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectlstages = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLastinspectlstages() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectlstages = 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 historyPolygonlocationMods) RandomLastinspectlstages(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lastinspectlstages = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lasttreatactivity(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLasttreatactivity() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatactivity = 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 historyPolygonlocationMods) RandomLasttreatactivity(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lasttreatdate(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLasttreatdate() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatdate = 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 historyPolygonlocationMods) RandomLasttreatdate(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lasttreatproduct(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLasttreatproduct() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatproduct = 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 historyPolygonlocationMods) RandomLasttreatproduct(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lasttreatqty(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLasttreatqty() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqty = 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 historyPolygonlocationMods) RandomLasttreatqty(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLasttreatqtyunit() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqtyunit = 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 historyPolygonlocationMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Locationnumber(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetLocationnumber() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Locationnumber = 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 historyPolygonlocationMods) RandomLocationnumber(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Name(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) NameFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetName() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Name = 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 historyPolygonlocationMods) RandomName(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetNextactiondatescheduled() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Nextactiondatescheduled = 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 historyPolygonlocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Objectid(val int32) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ObjectidFunc(f func() int32) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetObjectid() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPolygonlocationMods) RandomObjectid(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Priority(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) PriorityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetPriority() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Priority = 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 historyPolygonlocationMods) RandomPriority(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Symbology(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetSymbology() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Symbology = 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 historyPolygonlocationMods) RandomSymbology(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) ShapeArea(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetShapeArea() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeArea = 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 historyPolygonlocationMods) RandomShapeArea(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) ShapeLength(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetShapeLength() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeLength = 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 historyPolygonlocationMods) RandomShapeLength(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Usetype(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetUsetype() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Usetype = 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 historyPolygonlocationMods) RandomUsetype(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Waterorigin(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Waterorigin = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetWaterorigin() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Waterorigin = 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 historyPolygonlocationMods) RandomWaterorigin(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWateroriginNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Waterorigin = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Zone(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) ZoneFunc(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetZone() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone = 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 historyPolygonlocationMods) RandomZone(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Zone2(val null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) Zone2Func(f func() null.Val[string]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetZone2() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone2 = 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 historyPolygonlocationMods) RandomZone2(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) GeometryX(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetGeometryX() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryX = 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 historyPolygonlocationMods) RandomGeometryX(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) GeometryY(val null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetGeometryY() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryY = 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 historyPolygonlocationMods) RandomGeometryY(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPolygonlocationMods) Version(val int32) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPolygonlocationMods) VersionFunc(f func() int32) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyPolygonlocationMods) UnsetVersion() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPolygonlocationMods) RandomVersion(f *faker.Faker) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyPolygonlocationMods) WithParentsCascading() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { + if isDone, _ := historyPolygonlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyPolygonlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyPolygonlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { + o.r.Organization = &historyPolygonlocationROrganizationR{ + o: rel, + } + }) +} + +func (m historyPolygonlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyPolygonlocationMods) WithExistingOrganization(em *models.Organization) HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { + o.r.Organization = &historyPolygonlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyPolygonlocationMods) WithoutOrganization() HistoryPolygonlocationMod { + return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_pool.bob.go b/factory/history_pool.bob.go new file mode 100644 index 00000000..888262a4 --- /dev/null +++ b/factory/history_pool.bob.go @@ -0,0 +1,2231 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryPoolMod interface { + Apply(context.Context, *HistoryPoolTemplate) +} + +type HistoryPoolModFunc func(context.Context, *HistoryPoolTemplate) + +func (f HistoryPoolModFunc) Apply(ctx context.Context, n *HistoryPoolTemplate) { + f(ctx, n) +} + +type HistoryPoolModSlice []HistoryPoolMod + +func (mods HistoryPoolModSlice) Apply(ctx context.Context, n *HistoryPoolTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datesent func() null.Val[int64] + Datetested func() null.Val[int64] + Diseasepos func() null.Val[string] + Diseasetested func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Lab func() null.Val[string] + LabID func() null.Val[string] + Objectid func() int32 + Poolyear func() null.Val[int16] + Processed func() null.Val[int16] + Sampleid func() null.Val[string] + Survtech func() null.Val[string] + Testmethod func() null.Val[string] + Testtech func() null.Val[string] + TrapdataID func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Vectorsurvcollectionid func() null.Val[string] + Vectorsurvpoolid func() null.Val[string] + Vectorsurvtrapdataid func() null.Val[string] + Version func() int32 + + r historyPoolR + f *Factory + + alreadyPersisted bool +} + +type historyPoolR struct { + Organization *historyPoolROrganizationR +} + +type historyPoolROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryPoolTemplate +func (o *HistoryPoolTemplate) Apply(ctx context.Context, mods ...HistoryPoolMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryPool +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryPoolSetter +// this does nothing with the relationship templates +func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter { + m := &models.HistoryPoolSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datesent != nil { + val := o.Datesent() + m.Datesent = omitnull.FromNull(val) + } + if o.Datetested != nil { + val := o.Datetested() + m.Datetested = omitnull.FromNull(val) + } + if o.Diseasepos != nil { + val := o.Diseasepos() + m.Diseasepos = omitnull.FromNull(val) + } + if o.Diseasetested != nil { + val := o.Diseasetested() + m.Diseasetested = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lab != nil { + val := o.Lab() + m.Lab = omitnull.FromNull(val) + } + if o.LabID != nil { + val := o.LabID() + m.LabID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Poolyear != nil { + val := o.Poolyear() + m.Poolyear = omitnull.FromNull(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.Survtech != nil { + val := o.Survtech() + m.Survtech = omitnull.FromNull(val) + } + if o.Testmethod != nil { + val := o.Testmethod() + m.Testmethod = omitnull.FromNull(val) + } + if o.Testtech != nil { + val := o.Testtech() + m.Testtech = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Vectorsurvcollectionid != nil { + val := o.Vectorsurvcollectionid() + m.Vectorsurvcollectionid = omitnull.FromNull(val) + } + if o.Vectorsurvpoolid != nil { + val := o.Vectorsurvpoolid() + m.Vectorsurvpoolid = omitnull.FromNull(val) + } + if o.Vectorsurvtrapdataid != nil { + val := o.Vectorsurvtrapdataid() + m.Vectorsurvtrapdataid = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryPoolSetter +// this does nothing with the relationship templates +func (o HistoryPoolTemplate) BuildManySetter(number int) []*models.HistoryPoolSetter { + m := make([]*models.HistoryPoolSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryPool +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPoolTemplate.Create +func (o HistoryPoolTemplate) Build() *models.HistoryPool { + m := &models.HistoryPool{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datesent != nil { + m.Datesent = o.Datesent() + } + if o.Datetested != nil { + m.Datetested = o.Datetested() + } + if o.Diseasepos != nil { + m.Diseasepos = o.Diseasepos() + } + if o.Diseasetested != nil { + m.Diseasetested = o.Diseasetested() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lab != nil { + m.Lab = o.Lab() + } + if o.LabID != nil { + m.LabID = o.LabID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Poolyear != nil { + m.Poolyear = o.Poolyear() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.Survtech != nil { + m.Survtech = o.Survtech() + } + if o.Testmethod != nil { + m.Testmethod = o.Testmethod() + } + if o.Testtech != nil { + m.Testtech = o.Testtech() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Vectorsurvcollectionid != nil { + m.Vectorsurvcollectionid = o.Vectorsurvcollectionid() + } + if o.Vectorsurvpoolid != nil { + m.Vectorsurvpoolid = o.Vectorsurvpoolid() + } + if o.Vectorsurvtrapdataid != nil { + m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryPoolSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPoolTemplate.CreateMany +func (o HistoryPoolTemplate) BuildMany(number int) models.HistoryPoolSlice { + m := make(models.HistoryPoolSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryPool +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyPool and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPool, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryPool(opt) + + m, err := models.HistoryPools.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyPool and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPool { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyPool 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 *HistoryPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPool { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyPools and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPoolSlice, error) { + var err error + m := make(models.HistoryPoolSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyPools and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPoolSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyPools 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 HistoryPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPoolSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryPool has methods that act as mods for the HistoryPoolTemplate +var HistoryPoolMods historyPoolMods + +type historyPoolMods struct{} + +func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModSlice{ + HistoryPoolMods.RandomOrganizationID(f), + HistoryPoolMods.RandomComments(f), + HistoryPoolMods.RandomCreationdate(f), + HistoryPoolMods.RandomCreator(f), + HistoryPoolMods.RandomDatesent(f), + HistoryPoolMods.RandomDatetested(f), + HistoryPoolMods.RandomDiseasepos(f), + HistoryPoolMods.RandomDiseasetested(f), + HistoryPoolMods.RandomEditdate(f), + HistoryPoolMods.RandomEditor(f), + HistoryPoolMods.RandomGatewaysync(f), + HistoryPoolMods.RandomGlobalid(f), + HistoryPoolMods.RandomLab(f), + HistoryPoolMods.RandomLabID(f), + HistoryPoolMods.RandomObjectid(f), + HistoryPoolMods.RandomPoolyear(f), + HistoryPoolMods.RandomProcessed(f), + HistoryPoolMods.RandomSampleid(f), + HistoryPoolMods.RandomSurvtech(f), + HistoryPoolMods.RandomTestmethod(f), + HistoryPoolMods.RandomTesttech(f), + HistoryPoolMods.RandomTrapdataID(f), + HistoryPoolMods.RandomCreatedDate(f), + HistoryPoolMods.RandomCreatedUser(f), + HistoryPoolMods.RandomGeometryX(f), + HistoryPoolMods.RandomGeometryY(f), + HistoryPoolMods.RandomLastEditedDate(f), + HistoryPoolMods.RandomLastEditedUser(f), + HistoryPoolMods.RandomVectorsurvcollectionid(f), + HistoryPoolMods.RandomVectorsurvpoolid(f), + HistoryPoolMods.RandomVectorsurvtrapdataid(f), + HistoryPoolMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyPoolMods) OrganizationID(val null.Val[int32]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetOrganizationID() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Comments(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CommentsFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetComments() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Creationdate(val null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CreationdateFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetCreationdate() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Creator(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CreatorFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetCreator() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Datesent(val null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datesent = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) DatesentFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datesent = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetDatesent() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datesent = 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) RandomDatesent(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Datetested(val null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datetested = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) DatetestedFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datetested = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetDatetested() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datetested = 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) RandomDatetested(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Diseasepos(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasepos = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) DiseaseposFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasepos = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetDiseasepos() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasepos = 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) RandomDiseasepos(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseaseposNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Diseasetested(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasetested = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) DiseasetestedFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasetested = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetDiseasetested() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasetested = 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) RandomDiseasetested(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseasetestedNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Editdate(val null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) EditdateFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetEditdate() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Editor(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) EditorFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetEditor() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Gatewaysync(val null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetGatewaysync() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Gatewaysync = 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) RandomGatewaysync(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Globalid(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) GlobalidFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetGlobalid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Lab(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Lab = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) LabFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Lab = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetLab() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Lab = 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) RandomLab(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) LabID(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LabID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) LabIDFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LabID = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetLabID() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LabID = 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) RandomLabID(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LabID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabIDNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LabID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Objectid(val int32) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) ObjectidFunc(f func() int32) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetObjectid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPoolMods) RandomObjectid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Poolyear(val null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Poolyear = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) PoolyearFunc(f func() null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Poolyear = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetPoolyear() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Poolyear = 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) RandomPoolyear(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Poolyear = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPoolyearNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Poolyear = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Processed(val null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) ProcessedFunc(f func() null.Val[int16]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetProcessed() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Sampleid(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) SampleidFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetSampleid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Sampleid = 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) RandomSampleid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Survtech(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Survtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) SurvtechFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Survtech = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetSurvtech() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Survtech = 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) RandomSurvtech(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSurvtechNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Testmethod(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testmethod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) TestmethodFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testmethod = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetTestmethod() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testmethod = 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) RandomTestmethod(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTestmethodNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Testtech(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) TesttechFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testtech = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetTesttech() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testtech = 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) RandomTesttech(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTesttechNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) TrapdataID(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) TrapdataIDFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetTrapdataID() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.TrapdataID = 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) RandomTrapdataID(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CreatedDateFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetCreatedDate() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) CreatedUser(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CreatedUserFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetCreatedUser() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) GeometryX(val null.Val[float64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) GeometryXFunc(f func() null.Val[float64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetGeometryX() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) GeometryY(val null.Val[float64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) GeometryYFunc(f func() null.Val[float64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetGeometryY() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) LastEditedDate(val null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetLastEditedDate() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) LastEditedUser(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) LastEditedUserFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetLastEditedUser() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Vectorsurvcollectionid(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) VectorsurvcollectionidFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvcollectionid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetVectorsurvcollectionid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvcollectionid = 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) RandomVectorsurvcollectionid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvcollectionidNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvcollectionid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Vectorsurvpoolid(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) VectorsurvpoolidFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvpoolid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetVectorsurvpoolid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvpoolid = 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) RandomVectorsurvpoolid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvpoolidNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvpoolid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Vectorsurvtrapdataid(val null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvtrapdataid = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetVectorsurvtrapdataid() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvtrapdataid = 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) RandomVectorsurvtrapdataid(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPoolMods) Version(val int32) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) VersionFunc(f func() int32) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetVersion() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPoolMods) RandomVersion(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyPoolMods) WithParentsCascading() HistoryPoolMod { + return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { + if isDone, _ := historyPoolWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyPoolWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyPoolMods) WithOrganization(rel *OrganizationTemplate) HistoryPoolMod { + return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { + o.r.Organization = &historyPoolROrganizationR{ + o: rel, + } + }) +} + +func (m historyPoolMods) WithNewOrganization(mods ...OrganizationMod) HistoryPoolMod { + return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyPoolMods) WithExistingOrganization(em *models.Organization) HistoryPoolMod { + return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { + o.r.Organization = &historyPoolROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyPoolMods) WithoutOrganization() HistoryPoolMod { + return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_pooldetail.bob.go b/factory/history_pooldetail.bob.go new file mode 100644 index 00000000..54deeee2 --- /dev/null +++ b/factory/history_pooldetail.bob.go @@ -0,0 +1,1363 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryPooldetailMod interface { + Apply(context.Context, *HistoryPooldetailTemplate) +} + +type HistoryPooldetailModFunc func(context.Context, *HistoryPooldetailTemplate) + +func (f HistoryPooldetailModFunc) Apply(ctx context.Context, n *HistoryPooldetailTemplate) { + f(ctx, n) +} + +type HistoryPooldetailModSlice []HistoryPooldetailMod + +func (mods HistoryPooldetailModSlice) Apply(ctx context.Context, n *HistoryPooldetailTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Females func() null.Val[int16] + Globalid func() null.Val[string] + Objectid func() int32 + PoolID func() null.Val[string] + Species func() null.Val[string] + TrapdataID func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyPooldetailR + f *Factory + + alreadyPersisted bool +} + +type historyPooldetailR struct { + Organization *historyPooldetailROrganizationR +} + +type historyPooldetailROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryPooldetailTemplate +func (o *HistoryPooldetailTemplate) Apply(ctx context.Context, mods ...HistoryPooldetailMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryPooldetail +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryPooldetailSetter +// this does nothing with the relationship templates +func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter { + m := &models.HistoryPooldetailSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Females != nil { + val := o.Females() + m.Females = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.PoolID != nil { + val := o.PoolID() + m.PoolID = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryPooldetailSetter +// this does nothing with the relationship templates +func (o HistoryPooldetailTemplate) BuildManySetter(number int) []*models.HistoryPooldetailSetter { + m := make([]*models.HistoryPooldetailSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryPooldetail +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.Create +func (o HistoryPooldetailTemplate) Build() *models.HistoryPooldetail { + m := &models.HistoryPooldetail{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Females != nil { + m.Females = o.Females() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.PoolID != nil { + m.PoolID = o.PoolID() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryPooldetailSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.CreateMany +func (o HistoryPooldetailTemplate) BuildMany(number int) models.HistoryPooldetailSlice { + m := make(models.HistoryPooldetailSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryPooldetail +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyPooldetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPooldetail, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryPooldetail(opt) + + m, err := models.HistoryPooldetails.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyPooldetail and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPooldetail { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyPooldetail 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 *HistoryPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPooldetail { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyPooldetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPooldetailSlice, error) { + var err error + m := make(models.HistoryPooldetailSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyPooldetails and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPooldetailSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyPooldetails 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 HistoryPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPooldetailSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryPooldetail has methods that act as mods for the HistoryPooldetailTemplate +var HistoryPooldetailMods historyPooldetailMods + +type historyPooldetailMods struct{} + +func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModSlice{ + HistoryPooldetailMods.RandomOrganizationID(f), + HistoryPooldetailMods.RandomCreationdate(f), + HistoryPooldetailMods.RandomCreator(f), + HistoryPooldetailMods.RandomEditdate(f), + HistoryPooldetailMods.RandomEditor(f), + HistoryPooldetailMods.RandomFemales(f), + HistoryPooldetailMods.RandomGlobalid(f), + HistoryPooldetailMods.RandomObjectid(f), + HistoryPooldetailMods.RandomPoolID(f), + HistoryPooldetailMods.RandomSpecies(f), + HistoryPooldetailMods.RandomTrapdataID(f), + HistoryPooldetailMods.RandomCreatedDate(f), + HistoryPooldetailMods.RandomCreatedUser(f), + HistoryPooldetailMods.RandomGeometryX(f), + HistoryPooldetailMods.RandomGeometryY(f), + HistoryPooldetailMods.RandomLastEditedDate(f), + HistoryPooldetailMods.RandomLastEditedUser(f), + HistoryPooldetailMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyPooldetailMods) OrganizationID(val null.Val[int32]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetOrganizationID() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Creationdate(val null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) CreationdateFunc(f func() null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetCreationdate() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Creator(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) CreatorFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetCreator() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Editdate(val null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) EditdateFunc(f func() null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetEditdate() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Editor(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) EditorFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetEditor() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Females(val null.Val[int16]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Females = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) FemalesFunc(f func() null.Val[int16]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Females = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetFemales() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Females = 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) RandomFemales(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Females = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFemalesNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Females = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Globalid(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) GlobalidFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetGlobalid() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Objectid(val int32) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) ObjectidFunc(f func() int32) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetObjectid() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPooldetailMods) RandomObjectid(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) PoolID(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.PoolID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) PoolIDFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.PoolID = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetPoolID() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.PoolID = 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) RandomPoolID(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.PoolID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPoolIDNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.PoolID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Species(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) SpeciesFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetSpecies() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Species = 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) RandomSpecies(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) TrapdataID(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) TrapdataIDFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetTrapdataID() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.TrapdataID = 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) RandomTrapdataID(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) CreatedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetCreatedDate() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) CreatedUser(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) CreatedUserFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetCreatedUser() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) GeometryX(val null.Val[float64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) GeometryXFunc(f func() null.Val[float64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetGeometryX() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) GeometryY(val null.Val[float64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) GeometryYFunc(f func() null.Val[float64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetGeometryY() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) LastEditedDate(val null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetLastEditedDate() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) LastEditedUser(val null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetLastEditedUser() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyPooldetailMods) Version(val int32) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) VersionFunc(f func() int32) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetVersion() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyPooldetailMods) RandomVersion(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyPooldetailMods) WithParentsCascading() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { + if isDone, _ := historyPooldetailWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyPooldetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyPooldetailMods) WithOrganization(rel *OrganizationTemplate) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { + o.r.Organization = &historyPooldetailROrganizationR{ + o: rel, + } + }) +} + +func (m historyPooldetailMods) WithNewOrganization(mods ...OrganizationMod) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyPooldetailMods) WithExistingOrganization(em *models.Organization) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { + o.r.Organization = &historyPooldetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyPooldetailMods) WithoutOrganization() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_proposedtreatmentarea.bob.go b/factory/history_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..f539f42c --- /dev/null +++ b/factory/history_proposedtreatmentarea.bob.go @@ -0,0 +1,2541 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryProposedtreatmentareaMod interface { + Apply(context.Context, *HistoryProposedtreatmentareaTemplate) +} + +type HistoryProposedtreatmentareaModFunc func(context.Context, *HistoryProposedtreatmentareaTemplate) + +func (f HistoryProposedtreatmentareaModFunc) Apply(ctx context.Context, n *HistoryProposedtreatmentareaTemplate) { + f(ctx, n) +} + +type HistoryProposedtreatmentareaModSlice []HistoryProposedtreatmentareaMod + +func (mods HistoryProposedtreatmentareaModSlice) Apply(ctx context.Context, n *HistoryProposedtreatmentareaTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Acres func() null.Val[float64] + Comments func() null.Val[string] + Completed func() null.Val[int16] + Completedby func() null.Val[string] + Completeddate func() null.Val[int64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Duedate func() null.Val[int64] + Exported func() null.Val[int16] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Hectares func() null.Val[float64] + Issprayroute func() null.Val[int16] + Lasttreatactivity func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Lasttreatproduct func() null.Val[string] + Lasttreatqty func() null.Val[float64] + Lasttreatqtyunit func() null.Val[string] + Method func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + Priority func() null.Val[string] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Targetapprate func() null.Val[float64] + Targetproduct func() null.Val[string] + Targetspecies func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + Version func() int32 + + r historyProposedtreatmentareaR + f *Factory + + alreadyPersisted bool +} + +type historyProposedtreatmentareaR struct { + Organization *historyProposedtreatmentareaROrganizationR +} + +type historyProposedtreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryProposedtreatmentareaTemplate +func (o *HistoryProposedtreatmentareaTemplate) Apply(ctx context.Context, mods ...HistoryProposedtreatmentareaMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryProposedtreatmentarea +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryProposedtreatmentareaTemplate) setModelRels(o *models.HistoryProposedtreatmentarea) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryProposedtreatmentareaSetter +// this does nothing with the relationship templates +func (o HistoryProposedtreatmentareaTemplate) BuildSetter() *models.HistoryProposedtreatmentareaSetter { + m := &models.HistoryProposedtreatmentareaSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Acres != nil { + val := o.Acres() + m.Acres = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Completed != nil { + val := o.Completed() + m.Completed = omitnull.FromNull(val) + } + if o.Completedby != nil { + val := o.Completedby() + m.Completedby = omitnull.FromNull(val) + } + if o.Completeddate != nil { + val := o.Completeddate() + m.Completeddate = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Duedate != nil { + val := o.Duedate() + m.Duedate = omitnull.FromNull(val) + } + if o.Exported != nil { + val := o.Exported() + m.Exported = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Hectares != nil { + val := o.Hectares() + m.Hectares = omitnull.FromNull(val) + } + if o.Issprayroute != nil { + val := o.Issprayroute() + m.Issprayroute = omitnull.FromNull(val) + } + if o.Lasttreatactivity != nil { + val := o.Lasttreatactivity() + m.Lasttreatactivity = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Lasttreatproduct != nil { + val := o.Lasttreatproduct() + m.Lasttreatproduct = omitnull.FromNull(val) + } + if o.Lasttreatqty != nil { + val := o.Lasttreatqty() + m.Lasttreatqty = omitnull.FromNull(val) + } + if o.Lasttreatqtyunit != nil { + val := o.Lasttreatqtyunit() + m.Lasttreatqtyunit = omitnull.FromNull(val) + } + if o.Method != nil { + val := o.Method() + m.Method = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Targetapprate != nil { + val := o.Targetapprate() + m.Targetapprate = omitnull.FromNull(val) + } + if o.Targetproduct != nil { + val := o.Targetproduct() + m.Targetproduct = omitnull.FromNull(val) + } + if o.Targetspecies != nil { + val := o.Targetspecies() + m.Targetspecies = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryProposedtreatmentareaSetter +// this does nothing with the relationship templates +func (o HistoryProposedtreatmentareaTemplate) BuildManySetter(number int) []*models.HistoryProposedtreatmentareaSetter { + m := make([]*models.HistoryProposedtreatmentareaSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryProposedtreatmentarea +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryProposedtreatmentareaTemplate.Create +func (o HistoryProposedtreatmentareaTemplate) Build() *models.HistoryProposedtreatmentarea { + m := &models.HistoryProposedtreatmentarea{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Acres != nil { + m.Acres = o.Acres() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Completed != nil { + m.Completed = o.Completed() + } + if o.Completedby != nil { + m.Completedby = o.Completedby() + } + if o.Completeddate != nil { + m.Completeddate = o.Completeddate() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Duedate != nil { + m.Duedate = o.Duedate() + } + if o.Exported != nil { + m.Exported = o.Exported() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Hectares != nil { + m.Hectares = o.Hectares() + } + if o.Issprayroute != nil { + m.Issprayroute = o.Issprayroute() + } + if o.Lasttreatactivity != nil { + m.Lasttreatactivity = o.Lasttreatactivity() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Lasttreatproduct != nil { + m.Lasttreatproduct = o.Lasttreatproduct() + } + if o.Lasttreatqty != nil { + m.Lasttreatqty = o.Lasttreatqty() + } + if o.Lasttreatqtyunit != nil { + m.Lasttreatqtyunit = o.Lasttreatqtyunit() + } + if o.Method != nil { + m.Method = o.Method() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Targetapprate != nil { + m.Targetapprate = o.Targetapprate() + } + if o.Targetproduct != nil { + m.Targetproduct = o.Targetproduct() + } + if o.Targetspecies != nil { + m.Targetspecies = o.Targetspecies() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryProposedtreatmentareaSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryProposedtreatmentareaTemplate.CreateMany +func (o HistoryProposedtreatmentareaTemplate) BuildMany(number int) models.HistoryProposedtreatmentareaSlice { + m := make(models.HistoryProposedtreatmentareaSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentareaSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryProposedtreatmentarea +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyProposedtreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryProposedtreatmentarea, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryProposedtreatmentarea(opt) + + m, err := models.HistoryProposedtreatmentareas.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyProposedtreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryProposedtreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryProposedtreatmentarea { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyProposedtreatmentarea 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 *HistoryProposedtreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryProposedtreatmentarea { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyProposedtreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryProposedtreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryProposedtreatmentareaSlice, error) { + var err error + m := make(models.HistoryProposedtreatmentareaSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyProposedtreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryProposedtreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryProposedtreatmentareaSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyProposedtreatmentareas 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 HistoryProposedtreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryProposedtreatmentareaSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryProposedtreatmentarea has methods that act as mods for the HistoryProposedtreatmentareaTemplate +var HistoryProposedtreatmentareaMods historyProposedtreatmentareaMods + +type historyProposedtreatmentareaMods struct{} + +func (m historyProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModSlice{ + HistoryProposedtreatmentareaMods.RandomOrganizationID(f), + HistoryProposedtreatmentareaMods.RandomAcres(f), + HistoryProposedtreatmentareaMods.RandomComments(f), + HistoryProposedtreatmentareaMods.RandomCompleted(f), + HistoryProposedtreatmentareaMods.RandomCompletedby(f), + HistoryProposedtreatmentareaMods.RandomCompleteddate(f), + HistoryProposedtreatmentareaMods.RandomCreationdate(f), + HistoryProposedtreatmentareaMods.RandomCreator(f), + HistoryProposedtreatmentareaMods.RandomDuedate(f), + HistoryProposedtreatmentareaMods.RandomExported(f), + HistoryProposedtreatmentareaMods.RandomEditdate(f), + HistoryProposedtreatmentareaMods.RandomEditor(f), + HistoryProposedtreatmentareaMods.RandomGlobalid(f), + HistoryProposedtreatmentareaMods.RandomHectares(f), + HistoryProposedtreatmentareaMods.RandomIssprayroute(f), + HistoryProposedtreatmentareaMods.RandomLasttreatactivity(f), + HistoryProposedtreatmentareaMods.RandomLasttreatdate(f), + HistoryProposedtreatmentareaMods.RandomLasttreatproduct(f), + HistoryProposedtreatmentareaMods.RandomLasttreatqty(f), + HistoryProposedtreatmentareaMods.RandomLasttreatqtyunit(f), + HistoryProposedtreatmentareaMods.RandomMethod(f), + HistoryProposedtreatmentareaMods.RandomName(f), + HistoryProposedtreatmentareaMods.RandomObjectid(f), + HistoryProposedtreatmentareaMods.RandomPriority(f), + HistoryProposedtreatmentareaMods.RandomReviewed(f), + HistoryProposedtreatmentareaMods.RandomReviewedby(f), + HistoryProposedtreatmentareaMods.RandomRevieweddate(f), + HistoryProposedtreatmentareaMods.RandomShapeArea(f), + HistoryProposedtreatmentareaMods.RandomShapeLength(f), + HistoryProposedtreatmentareaMods.RandomTargetapprate(f), + HistoryProposedtreatmentareaMods.RandomTargetproduct(f), + HistoryProposedtreatmentareaMods.RandomTargetspecies(f), + HistoryProposedtreatmentareaMods.RandomZone(f), + HistoryProposedtreatmentareaMods.RandomZone2(f), + HistoryProposedtreatmentareaMods.RandomGeometryX(f), + HistoryProposedtreatmentareaMods.RandomGeometryY(f), + HistoryProposedtreatmentareaMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) OrganizationID(val null.Val[int32]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetOrganizationID() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Acres(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) AcresFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Acres = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetAcres() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Acres = 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 historyProposedtreatmentareaMods) RandomAcres(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Acres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Comments(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CommentsFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetComments() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Comments = 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 historyProposedtreatmentareaMods) RandomComments(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Completed(val null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completed = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetCompleted() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completed = 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 historyProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCompletedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Completedby(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CompletedbyFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completedby = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetCompletedby() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completedby = 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 historyProposedtreatmentareaMods) RandomCompletedby(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCompletedbyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Completeddate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CompleteddateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completeddate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetCompleteddate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completeddate = 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 historyProposedtreatmentareaMods) RandomCompleteddate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCompleteddateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Completeddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Creationdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetCreationdate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creationdate = 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 historyProposedtreatmentareaMods) RandomCreationdate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Creator(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) CreatorFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetCreator() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creator = 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 historyProposedtreatmentareaMods) RandomCreator(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Duedate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) DuedateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Duedate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetDuedate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Duedate = 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 historyProposedtreatmentareaMods) RandomDuedate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Exported(val null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Exported = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetExported() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Exported = 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 historyProposedtreatmentareaMods) RandomExported(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomExportedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Exported = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Editdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) EditdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetEditdate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editdate = 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 historyProposedtreatmentareaMods) RandomEditdate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Editor(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) EditorFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetEditor() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editor = 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 historyProposedtreatmentareaMods) RandomEditor(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Globalid(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) GlobalidFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetGlobalid() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Globalid = 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 historyProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Hectares(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) HectaresFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Hectares = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetHectares() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Hectares = 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 historyProposedtreatmentareaMods) RandomHectares(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomHectaresNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Hectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Issprayroute = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetIssprayroute() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Issprayroute = 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 historyProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomIssprayrouteNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Issprayroute = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Lasttreatactivity(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatactivity = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetLasttreatactivity() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatactivity = 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 historyProposedtreatmentareaMods) RandomLasttreatactivity(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatactivity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Lasttreatdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetLasttreatdate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatdate = 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 historyProposedtreatmentareaMods) RandomLasttreatdate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Lasttreatproduct(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) LasttreatproductFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatproduct = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetLasttreatproduct() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatproduct = 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 historyProposedtreatmentareaMods) RandomLasttreatproduct(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatproductNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Lasttreatqty(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqty = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetLasttreatqty() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqty = 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 historyProposedtreatmentareaMods) RandomLasttreatqty(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Lasttreatqtyunit(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetLasttreatqtyunit() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = 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 historyProposedtreatmentareaMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Lasttreatqtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Method(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Method = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetMethod() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Method = 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 historyProposedtreatmentareaMods) RandomMethod(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMethodNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Name(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) NameFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetName() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Name = 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 historyProposedtreatmentareaMods) RandomName(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Objectid(val int32) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ObjectidFunc(f func() int32) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetObjectid() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Priority(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetPriority() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Priority = 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 historyProposedtreatmentareaMods) RandomPriority(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Reviewed(val null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetReviewed() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewed = 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 historyProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Reviewedby(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ReviewedbyFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetReviewedby() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewedby = 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 historyProposedtreatmentareaMods) RandomReviewedby(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Revieweddate(val null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) RevieweddateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetRevieweddate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Revieweddate = 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 historyProposedtreatmentareaMods) RandomRevieweddate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) ShapeArea(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetShapeArea() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeArea = 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 historyProposedtreatmentareaMods) RandomShapeArea(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) ShapeLength(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetShapeLength() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeLength = 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 historyProposedtreatmentareaMods) RandomShapeLength(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Targetapprate(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) TargetapprateFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetapprate = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetTargetapprate() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetapprate = 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 historyProposedtreatmentareaMods) RandomTargetapprate(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTargetapprateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetapprate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Targetproduct(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) TargetproductFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetproduct = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetTargetproduct() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetproduct = 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 historyProposedtreatmentareaMods) RandomTargetproduct(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetproductNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetproduct = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Targetspecies(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) TargetspeciesFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetspecies = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetTargetspecies() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetspecies = 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 historyProposedtreatmentareaMods) RandomTargetspecies(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetspeciesNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Zone(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) ZoneFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetZone() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone = 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 historyProposedtreatmentareaMods) RandomZone(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Zone2(val null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) Zone2Func(f func() null.Val[string]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetZone2() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone2 = 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 historyProposedtreatmentareaMods) RandomZone2(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) GeometryX(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetGeometryX() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryX = 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 historyProposedtreatmentareaMods) RandomGeometryX(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) GeometryY(val null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetGeometryY() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryY = 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 historyProposedtreatmentareaMods) RandomGeometryY(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyProposedtreatmentareaMods) Version(val int32) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyProposedtreatmentareaMods) VersionFunc(f func() int32) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyProposedtreatmentareaMods) UnsetVersion() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyProposedtreatmentareaMods) RandomVersion(f *faker.Faker) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyProposedtreatmentareaMods) WithParentsCascading() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { + if isDone, _ := historyProposedtreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyProposedtreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyProposedtreatmentareaMods) WithOrganization(rel *OrganizationTemplate) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.r.Organization = &historyProposedtreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m historyProposedtreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyProposedtreatmentareaMods) WithExistingOrganization(em *models.Organization) HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.r.Organization = &historyProposedtreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyProposedtreatmentareaMods) WithoutOrganization() HistoryProposedtreatmentareaMod { + return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_qamosquitoinspection.bob.go b/factory/history_qamosquitoinspection.bob.go new file mode 100644 index 00000000..f4c84aee --- /dev/null +++ b/factory/history_qamosquitoinspection.bob.go @@ -0,0 +1,4339 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryQamosquitoinspectionMod interface { + Apply(context.Context, *HistoryQamosquitoinspectionTemplate) +} + +type HistoryQamosquitoinspectionModFunc func(context.Context, *HistoryQamosquitoinspectionTemplate) + +func (f HistoryQamosquitoinspectionModFunc) Apply(ctx context.Context, n *HistoryQamosquitoinspectionTemplate) { + f(ctx, n) +} + +type HistoryQamosquitoinspectionModSlice []HistoryQamosquitoinspectionMod + +func (mods HistoryQamosquitoinspectionModSlice) Apply(ctx context.Context, n *HistoryQamosquitoinspectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Acresbreeding func() null.Val[float64] + Actiontaken func() null.Val[string] + Adultactivity func() null.Val[int16] + Aquaticorganisms func() null.Val[string] + Avetemp func() null.Val[float64] + Breedingpotential func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Fish func() null.Val[int16] + Globalid func() null.Val[string] + Habvalue1 func() null.Val[int16] + Habvalue1percent func() null.Val[int16] + Habvalue2 func() null.Val[int16] + Habvalue2percent func() null.Val[int16] + Larvaeinsidetreatedarea func() null.Val[int16] + Larvaeoutsidetreatedarea func() null.Val[int16] + Larvaepresent func() null.Val[int16] + Larvaereason func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + LR func() null.Val[int16] + Mosquitohabitat func() null.Val[string] + Movingwater func() null.Val[int16] + Negdips func() null.Val[int16] + Nowaterever func() null.Val[int16] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Posdips func() null.Val[int16] + Potential func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sitetype func() null.Val[string] + Soilconditions func() null.Val[string] + Sourcereduction func() null.Val[string] + Startdatetime func() null.Val[int64] + Totalacres func() null.Val[float64] + Vegetation func() null.Val[string] + Waterconditions func() null.Val[string] + Waterduration func() null.Val[string] + Watermovement1 func() null.Val[string] + Watermovement1percent func() null.Val[int16] + Watermovement2 func() null.Val[string] + Watermovement2percent func() null.Val[int16] + Waterpresent func() null.Val[int16] + Watersource func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyQamosquitoinspectionR + f *Factory + + alreadyPersisted bool +} + +type historyQamosquitoinspectionR struct { + Organization *historyQamosquitoinspectionROrganizationR +} + +type historyQamosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryQamosquitoinspectionTemplate +func (o *HistoryQamosquitoinspectionTemplate) Apply(ctx context.Context, mods ...HistoryQamosquitoinspectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryQamosquitoinspection +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryQamosquitoinspectionTemplate) setModelRels(o *models.HistoryQamosquitoinspection) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryQamosquitoinspectionSetter +// this does nothing with the relationship templates +func (o HistoryQamosquitoinspectionTemplate) BuildSetter() *models.HistoryQamosquitoinspectionSetter { + m := &models.HistoryQamosquitoinspectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Acresbreeding != nil { + val := o.Acresbreeding() + m.Acresbreeding = omitnull.FromNull(val) + } + if o.Actiontaken != nil { + val := o.Actiontaken() + m.Actiontaken = omitnull.FromNull(val) + } + if o.Adultactivity != nil { + val := o.Adultactivity() + m.Adultactivity = omitnull.FromNull(val) + } + if o.Aquaticorganisms != nil { + val := o.Aquaticorganisms() + m.Aquaticorganisms = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Breedingpotential != nil { + val := o.Breedingpotential() + m.Breedingpotential = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Fish != nil { + val := o.Fish() + m.Fish = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habvalue1 != nil { + val := o.Habvalue1() + m.Habvalue1 = omitnull.FromNull(val) + } + if o.Habvalue1percent != nil { + val := o.Habvalue1percent() + m.Habvalue1percent = omitnull.FromNull(val) + } + if o.Habvalue2 != nil { + val := o.Habvalue2() + m.Habvalue2 = omitnull.FromNull(val) + } + if o.Habvalue2percent != nil { + val := o.Habvalue2percent() + m.Habvalue2percent = omitnull.FromNull(val) + } + if o.Larvaeinsidetreatedarea != nil { + val := o.Larvaeinsidetreatedarea() + m.Larvaeinsidetreatedarea = omitnull.FromNull(val) + } + if o.Larvaeoutsidetreatedarea != nil { + val := o.Larvaeoutsidetreatedarea() + m.Larvaeoutsidetreatedarea = omitnull.FromNull(val) + } + if o.Larvaepresent != nil { + val := o.Larvaepresent() + m.Larvaepresent = omitnull.FromNull(val) + } + if o.Larvaereason != nil { + val := o.Larvaereason() + m.Larvaereason = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LR != nil { + val := o.LR() + m.LR = omitnull.FromNull(val) + } + if o.Mosquitohabitat != nil { + val := o.Mosquitohabitat() + m.Mosquitohabitat = omitnull.FromNull(val) + } + if o.Movingwater != nil { + val := o.Movingwater() + m.Movingwater = omitnull.FromNull(val) + } + if o.Negdips != nil { + val := o.Negdips() + m.Negdips = omitnull.FromNull(val) + } + if o.Nowaterever != nil { + val := o.Nowaterever() + m.Nowaterever = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Posdips != nil { + val := o.Posdips() + m.Posdips = omitnull.FromNull(val) + } + if o.Potential != nil { + val := o.Potential() + m.Potential = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sitetype != nil { + val := o.Sitetype() + m.Sitetype = omitnull.FromNull(val) + } + if o.Soilconditions != nil { + val := o.Soilconditions() + m.Soilconditions = omitnull.FromNull(val) + } + if o.Sourcereduction != nil { + val := o.Sourcereduction() + m.Sourcereduction = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Totalacres != nil { + val := o.Totalacres() + m.Totalacres = omitnull.FromNull(val) + } + if o.Vegetation != nil { + val := o.Vegetation() + m.Vegetation = omitnull.FromNull(val) + } + if o.Waterconditions != nil { + val := o.Waterconditions() + m.Waterconditions = omitnull.FromNull(val) + } + if o.Waterduration != nil { + val := o.Waterduration() + m.Waterduration = omitnull.FromNull(val) + } + if o.Watermovement1 != nil { + val := o.Watermovement1() + m.Watermovement1 = omitnull.FromNull(val) + } + if o.Watermovement1percent != nil { + val := o.Watermovement1percent() + m.Watermovement1percent = omitnull.FromNull(val) + } + if o.Watermovement2 != nil { + val := o.Watermovement2() + m.Watermovement2 = omitnull.FromNull(val) + } + if o.Watermovement2percent != nil { + val := o.Watermovement2percent() + m.Watermovement2percent = omitnull.FromNull(val) + } + if o.Waterpresent != nil { + val := o.Waterpresent() + m.Waterpresent = omitnull.FromNull(val) + } + if o.Watersource != nil { + val := o.Watersource() + m.Watersource = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryQamosquitoinspectionSetter +// this does nothing with the relationship templates +func (o HistoryQamosquitoinspectionTemplate) BuildManySetter(number int) []*models.HistoryQamosquitoinspectionSetter { + m := make([]*models.HistoryQamosquitoinspectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryQamosquitoinspection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryQamosquitoinspectionTemplate.Create +func (o HistoryQamosquitoinspectionTemplate) Build() *models.HistoryQamosquitoinspection { + m := &models.HistoryQamosquitoinspection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Acresbreeding != nil { + m.Acresbreeding = o.Acresbreeding() + } + if o.Actiontaken != nil { + m.Actiontaken = o.Actiontaken() + } + if o.Adultactivity != nil { + m.Adultactivity = o.Adultactivity() + } + if o.Aquaticorganisms != nil { + m.Aquaticorganisms = o.Aquaticorganisms() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Breedingpotential != nil { + m.Breedingpotential = o.Breedingpotential() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Fish != nil { + m.Fish = o.Fish() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habvalue1 != nil { + m.Habvalue1 = o.Habvalue1() + } + if o.Habvalue1percent != nil { + m.Habvalue1percent = o.Habvalue1percent() + } + if o.Habvalue2 != nil { + m.Habvalue2 = o.Habvalue2() + } + if o.Habvalue2percent != nil { + m.Habvalue2percent = o.Habvalue2percent() + } + if o.Larvaeinsidetreatedarea != nil { + m.Larvaeinsidetreatedarea = o.Larvaeinsidetreatedarea() + } + if o.Larvaeoutsidetreatedarea != nil { + m.Larvaeoutsidetreatedarea = o.Larvaeoutsidetreatedarea() + } + if o.Larvaepresent != nil { + m.Larvaepresent = o.Larvaepresent() + } + if o.Larvaereason != nil { + m.Larvaereason = o.Larvaereason() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LR != nil { + m.LR = o.LR() + } + if o.Mosquitohabitat != nil { + m.Mosquitohabitat = o.Mosquitohabitat() + } + if o.Movingwater != nil { + m.Movingwater = o.Movingwater() + } + if o.Negdips != nil { + m.Negdips = o.Negdips() + } + if o.Nowaterever != nil { + m.Nowaterever = o.Nowaterever() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Posdips != nil { + m.Posdips = o.Posdips() + } + if o.Potential != nil { + m.Potential = o.Potential() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sitetype != nil { + m.Sitetype = o.Sitetype() + } + if o.Soilconditions != nil { + m.Soilconditions = o.Soilconditions() + } + if o.Sourcereduction != nil { + m.Sourcereduction = o.Sourcereduction() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Totalacres != nil { + m.Totalacres = o.Totalacres() + } + if o.Vegetation != nil { + m.Vegetation = o.Vegetation() + } + if o.Waterconditions != nil { + m.Waterconditions = o.Waterconditions() + } + if o.Waterduration != nil { + m.Waterduration = o.Waterduration() + } + if o.Watermovement1 != nil { + m.Watermovement1 = o.Watermovement1() + } + if o.Watermovement1percent != nil { + m.Watermovement1percent = o.Watermovement1percent() + } + if o.Watermovement2 != nil { + m.Watermovement2 = o.Watermovement2() + } + if o.Watermovement2percent != nil { + m.Watermovement2percent = o.Watermovement2percent() + } + if o.Waterpresent != nil { + m.Waterpresent = o.Waterpresent() + } + if o.Watersource != nil { + m.Watersource = o.Watersource() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryQamosquitoinspectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryQamosquitoinspectionTemplate.CreateMany +func (o HistoryQamosquitoinspectionTemplate) BuildMany(number int) models.HistoryQamosquitoinspectionSlice { + m := make(models.HistoryQamosquitoinspectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryQamosquitoinspection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyQamosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryQamosquitoinspection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryQamosquitoinspection(opt) + + m, err := models.HistoryQamosquitoinspections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyQamosquitoinspection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryQamosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryQamosquitoinspection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyQamosquitoinspection 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 *HistoryQamosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryQamosquitoinspection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyQamosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryQamosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryQamosquitoinspectionSlice, error) { + var err error + m := make(models.HistoryQamosquitoinspectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyQamosquitoinspections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryQamosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryQamosquitoinspectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyQamosquitoinspections 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 HistoryQamosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryQamosquitoinspectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryQamosquitoinspection has methods that act as mods for the HistoryQamosquitoinspectionTemplate +var HistoryQamosquitoinspectionMods historyQamosquitoinspectionMods + +type historyQamosquitoinspectionMods struct{} + +func (m historyQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModSlice{ + HistoryQamosquitoinspectionMods.RandomOrganizationID(f), + HistoryQamosquitoinspectionMods.RandomAcresbreeding(f), + HistoryQamosquitoinspectionMods.RandomActiontaken(f), + HistoryQamosquitoinspectionMods.RandomAdultactivity(f), + HistoryQamosquitoinspectionMods.RandomAquaticorganisms(f), + HistoryQamosquitoinspectionMods.RandomAvetemp(f), + HistoryQamosquitoinspectionMods.RandomBreedingpotential(f), + HistoryQamosquitoinspectionMods.RandomComments(f), + HistoryQamosquitoinspectionMods.RandomCreationdate(f), + HistoryQamosquitoinspectionMods.RandomCreator(f), + HistoryQamosquitoinspectionMods.RandomEnddatetime(f), + HistoryQamosquitoinspectionMods.RandomEditdate(f), + HistoryQamosquitoinspectionMods.RandomEditor(f), + HistoryQamosquitoinspectionMods.RandomFieldtech(f), + HistoryQamosquitoinspectionMods.RandomFish(f), + HistoryQamosquitoinspectionMods.RandomGlobalid(f), + HistoryQamosquitoinspectionMods.RandomHabvalue1(f), + HistoryQamosquitoinspectionMods.RandomHabvalue1percent(f), + HistoryQamosquitoinspectionMods.RandomHabvalue2(f), + HistoryQamosquitoinspectionMods.RandomHabvalue2percent(f), + HistoryQamosquitoinspectionMods.RandomLarvaeinsidetreatedarea(f), + HistoryQamosquitoinspectionMods.RandomLarvaeoutsidetreatedarea(f), + HistoryQamosquitoinspectionMods.RandomLarvaepresent(f), + HistoryQamosquitoinspectionMods.RandomLarvaereason(f), + HistoryQamosquitoinspectionMods.RandomLinelocid(f), + HistoryQamosquitoinspectionMods.RandomLocationname(f), + HistoryQamosquitoinspectionMods.RandomLR(f), + HistoryQamosquitoinspectionMods.RandomMosquitohabitat(f), + HistoryQamosquitoinspectionMods.RandomMovingwater(f), + HistoryQamosquitoinspectionMods.RandomNegdips(f), + HistoryQamosquitoinspectionMods.RandomNowaterever(f), + HistoryQamosquitoinspectionMods.RandomObjectid(f), + HistoryQamosquitoinspectionMods.RandomPointlocid(f), + HistoryQamosquitoinspectionMods.RandomPolygonlocid(f), + HistoryQamosquitoinspectionMods.RandomPosdips(f), + HistoryQamosquitoinspectionMods.RandomPotential(f), + HistoryQamosquitoinspectionMods.RandomRaingauge(f), + HistoryQamosquitoinspectionMods.RandomRecordstatus(f), + HistoryQamosquitoinspectionMods.RandomReviewed(f), + HistoryQamosquitoinspectionMods.RandomReviewedby(f), + HistoryQamosquitoinspectionMods.RandomRevieweddate(f), + HistoryQamosquitoinspectionMods.RandomSitetype(f), + HistoryQamosquitoinspectionMods.RandomSoilconditions(f), + HistoryQamosquitoinspectionMods.RandomSourcereduction(f), + HistoryQamosquitoinspectionMods.RandomStartdatetime(f), + HistoryQamosquitoinspectionMods.RandomTotalacres(f), + HistoryQamosquitoinspectionMods.RandomVegetation(f), + HistoryQamosquitoinspectionMods.RandomWaterconditions(f), + HistoryQamosquitoinspectionMods.RandomWaterduration(f), + HistoryQamosquitoinspectionMods.RandomWatermovement1(f), + HistoryQamosquitoinspectionMods.RandomWatermovement1percent(f), + HistoryQamosquitoinspectionMods.RandomWatermovement2(f), + HistoryQamosquitoinspectionMods.RandomWatermovement2percent(f), + HistoryQamosquitoinspectionMods.RandomWaterpresent(f), + HistoryQamosquitoinspectionMods.RandomWatersource(f), + HistoryQamosquitoinspectionMods.RandomWinddir(f), + HistoryQamosquitoinspectionMods.RandomWindspeed(f), + HistoryQamosquitoinspectionMods.RandomZone(f), + HistoryQamosquitoinspectionMods.RandomZone2(f), + HistoryQamosquitoinspectionMods.RandomCreatedDate(f), + HistoryQamosquitoinspectionMods.RandomCreatedUser(f), + HistoryQamosquitoinspectionMods.RandomGeometryX(f), + HistoryQamosquitoinspectionMods.RandomGeometryY(f), + HistoryQamosquitoinspectionMods.RandomLastEditedDate(f), + HistoryQamosquitoinspectionMods.RandomLastEditedUser(f), + HistoryQamosquitoinspectionMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) OrganizationID(val null.Val[int32]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetOrganizationID() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Acresbreeding(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) AcresbreedingFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Acresbreeding = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetAcresbreeding() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Acresbreeding = 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) RandomAcresbreeding(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAcresbreedingNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Acresbreeding = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Actiontaken(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Actiontaken = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetActiontaken() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Actiontaken = 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) RandomActiontaken(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActiontakenNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Actiontaken = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Adultactivity = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetAdultactivity() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Adultactivity = 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) RandomAdultactivity(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomAdultactivityNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Adultactivity = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Aquaticorganisms = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetAquaticorganisms() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Aquaticorganisms = 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) RandomAquaticorganisms(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAquaticorganismsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Aquaticorganisms = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Avetemp(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetAvetemp() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Avetemp = 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) RandomAvetemp(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Breedingpotential = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetBreedingpotential() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Breedingpotential = 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) RandomBreedingpotential(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBreedingpotentialNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Breedingpotential = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Comments(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetComments() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Creationdate(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetCreationdate() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Creator(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetCreator() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Enddatetime(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetEnddatetime() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Enddatetime = 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) RandomEnddatetime(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Editdate(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetEditdate() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Editor(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) EditorFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetEditor() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Fieldtech(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetFieldtech() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Fish(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fish = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetFish() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fish = 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) RandomFish(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomFishNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Fish = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Globalid(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetGlobalid() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Habvalue1(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Habvalue1Func(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1 = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetHabvalue1() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1 = 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) RandomHabvalue1(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue1NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Habvalue1percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Habvalue1percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1percent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetHabvalue1percent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1percent = 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) RandomHabvalue1percent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue1percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Habvalue2(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Habvalue2Func(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2 = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetHabvalue2() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2 = 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) RandomHabvalue2(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2 = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Habvalue2percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Habvalue2percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2percent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetHabvalue2percent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2percent = 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) RandomHabvalue2percent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomHabvalue2percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Habvalue2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = 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) RandomLarvaeinsidetreatedarea(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = 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) RandomLarvaeoutsidetreatedarea(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaepresent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLarvaepresent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaepresent = 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) RandomLarvaepresent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaepresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Larvaereason(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaereason = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLarvaereason() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaereason = 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) RandomLarvaereason(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLarvaereasonNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Larvaereason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Linelocid(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLinelocid() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Linelocid = 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) RandomLinelocid(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Locationname(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLocationname() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) LR(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LRFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LR = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLR() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LR = 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) RandomLR(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLRNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Mosquitohabitat = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetMosquitohabitat() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Mosquitohabitat = 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) RandomMosquitohabitat(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMosquitohabitatNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Mosquitohabitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Movingwater(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Movingwater = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetMovingwater() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Movingwater = 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) RandomMovingwater(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomMovingwaterNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Movingwater = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Negdips(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) NegdipsFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Negdips = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetNegdips() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Negdips = 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) RandomNegdips(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNegdipsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Negdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Nowaterever = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetNowaterever() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Nowaterever = 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) RandomNowaterever(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNowatereverNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Nowaterever = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Objectid(val int32) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) ObjectidFunc(f func() int32) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetObjectid() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyQamosquitoinspectionMods) RandomObjectid(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Pointlocid(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetPointlocid() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Pointlocid = 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) RandomPointlocid(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Polygonlocid(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetPolygonlocid() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Polygonlocid = 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) RandomPolygonlocid(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Posdips(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Posdips = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetPosdips() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Posdips = 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) RandomPosdips(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Posdips = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Potential(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) PotentialFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Potential = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetPotential() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Potential = 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) RandomPotential(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPotentialNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Potential = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Raingauge(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetRaingauge() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Raingauge = 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) RandomRaingauge(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Recordstatus(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetRecordstatus() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Recordstatus = 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) RandomRecordstatus(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Reviewed(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetReviewed() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewed = 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) RandomReviewed(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Reviewedby(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetReviewedby() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewedby = 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) RandomReviewedby(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Revieweddate(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetRevieweddate() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Revieweddate = 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) RandomRevieweddate(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Sitetype(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sitetype = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetSitetype() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sitetype = 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) RandomSitetype(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitetypeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sitetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Soilconditions(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Soilconditions = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetSoilconditions() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Soilconditions = 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) RandomSoilconditions(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSoilconditionsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Soilconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sourcereduction = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetSourcereduction() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sourcereduction = 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) RandomSourcereduction(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourcereductionNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Sourcereduction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Startdatetime(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetStartdatetime() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Startdatetime = 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) RandomStartdatetime(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Totalacres(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) TotalacresFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Totalacres = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetTotalacres() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Totalacres = 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) RandomTotalacres(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTotalacresNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Totalacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Vegetation(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Vegetation = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetVegetation() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Vegetation = 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) RandomVegetation(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVegetationNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Vegetation = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Waterconditions(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterconditions = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWaterconditions() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterconditions = 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) RandomWaterconditions(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWaterconditionsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Waterduration(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterduration = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWaterduration() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterduration = 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) RandomWaterduration(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWaterdurationNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterduration = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Watermovement1(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1 = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWatermovement1() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1 = 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) RandomWatermovement1(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatermovement1NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Watermovement1percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Watermovement1percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1percent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWatermovement1percent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1percent = 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) RandomWatermovement1percent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWatermovement1percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement1percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Watermovement2(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2 = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWatermovement2() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2 = 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) RandomWatermovement2(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatermovement2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Watermovement2percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Watermovement2percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2percent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWatermovement2percent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2percent = 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) RandomWatermovement2percent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWatermovement2percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watermovement2percent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterpresent = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWaterpresent() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterpresent = 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) RandomWaterpresent(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWaterpresentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Waterpresent = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Watersource(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watersource = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWatersource() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watersource = 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) RandomWatersource(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWatersourceNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Watersource = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Winddir(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWinddir() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Winddir = 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) RandomWinddir(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Windspeed(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetWindspeed() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Windspeed = 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) RandomWindspeed(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Zone(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetZone() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Zone2(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) Zone2Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetZone2() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetCreatedDate() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) CreatedUser(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetCreatedUser() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) GeometryX(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetGeometryX() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) GeometryY(val null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetGeometryY() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) LastEditedDate(val null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLastEditedDate() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) LastEditedUser(val null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetLastEditedUser() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Version(val int32) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) VersionFunc(f func() int32) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetVersion() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyQamosquitoinspectionMods) RandomVersion(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyQamosquitoinspectionMods) WithParentsCascading() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { + if isDone, _ := historyQamosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyQamosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyQamosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.r.Organization = &historyQamosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m historyQamosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyQamosquitoinspectionMods) WithExistingOrganization(em *models.Organization) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.r.Organization = &historyQamosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyQamosquitoinspectionMods) WithoutOrganization() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_rodentlocation.bob.go b/factory/history_rodentlocation.bob.go new file mode 100644 index 00000000..4bf25520 --- /dev/null +++ b/factory/history_rodentlocation.bob.go @@ -0,0 +1,2355 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryRodentlocationMod interface { + Apply(context.Context, *HistoryRodentlocationTemplate) +} + +type HistoryRodentlocationModFunc func(context.Context, *HistoryRodentlocationTemplate) + +func (f HistoryRodentlocationModFunc) Apply(ctx context.Context, n *HistoryRodentlocationTemplate) { + f(ctx, n) +} + +type HistoryRodentlocationModSlice []HistoryRodentlocationMod + +func (mods HistoryRodentlocationModSlice) Apply(ctx context.Context, n *HistoryRodentlocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Lastinspectaction func() null.Val[string] + Lastinspectconditions func() null.Val[string] + Lastinspectdate func() null.Val[int64] + Lastinspectrodentevidence func() null.Val[string] + Lastinspectspecies func() null.Val[string] + Locationname func() null.Val[string] + Locationnumber func() null.Val[int64] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Symbology func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Jurisdiction func() null.Val[string] + Version func() int32 + + r historyRodentlocationR + f *Factory + + alreadyPersisted bool +} + +type historyRodentlocationR struct { + Organization *historyRodentlocationROrganizationR +} + +type historyRodentlocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryRodentlocationTemplate +func (o *HistoryRodentlocationTemplate) Apply(ctx context.Context, mods ...HistoryRodentlocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryRodentlocation +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryRodentlocationTemplate) setModelRels(o *models.HistoryRodentlocation) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryRodentlocationSetter +// this does nothing with the relationship templates +func (o HistoryRodentlocationTemplate) BuildSetter() *models.HistoryRodentlocationSetter { + m := &models.HistoryRodentlocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Lastinspectaction != nil { + val := o.Lastinspectaction() + m.Lastinspectaction = omitnull.FromNull(val) + } + if o.Lastinspectconditions != nil { + val := o.Lastinspectconditions() + m.Lastinspectconditions = omitnull.FromNull(val) + } + if o.Lastinspectdate != nil { + val := o.Lastinspectdate() + m.Lastinspectdate = omitnull.FromNull(val) + } + if o.Lastinspectrodentevidence != nil { + val := o.Lastinspectrodentevidence() + m.Lastinspectrodentevidence = omitnull.FromNull(val) + } + if o.Lastinspectspecies != nil { + val := o.Lastinspectspecies() + m.Lastinspectspecies = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryRodentlocationSetter +// this does nothing with the relationship templates +func (o HistoryRodentlocationTemplate) BuildManySetter(number int) []*models.HistoryRodentlocationSetter { + m := make([]*models.HistoryRodentlocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryRodentlocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryRodentlocationTemplate.Create +func (o HistoryRodentlocationTemplate) Build() *models.HistoryRodentlocation { + m := &models.HistoryRodentlocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Lastinspectaction != nil { + m.Lastinspectaction = o.Lastinspectaction() + } + if o.Lastinspectconditions != nil { + m.Lastinspectconditions = o.Lastinspectconditions() + } + if o.Lastinspectdate != nil { + m.Lastinspectdate = o.Lastinspectdate() + } + if o.Lastinspectrodentevidence != nil { + m.Lastinspectrodentevidence = o.Lastinspectrodentevidence() + } + if o.Lastinspectspecies != nil { + m.Lastinspectspecies = o.Lastinspectspecies() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryRodentlocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryRodentlocationTemplate.CreateMany +func (o HistoryRodentlocationTemplate) BuildMany(number int) models.HistoryRodentlocationSlice { + m := make(models.HistoryRodentlocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryRodentlocation(m *models.HistoryRodentlocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryRodentlocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyRodentlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryRodentlocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryRodentlocation(opt) + + m, err := models.HistoryRodentlocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyRodentlocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryRodentlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryRodentlocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyRodentlocation 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 *HistoryRodentlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryRodentlocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyRodentlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryRodentlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryRodentlocationSlice, error) { + var err error + m := make(models.HistoryRodentlocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyRodentlocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryRodentlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryRodentlocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyRodentlocations 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 HistoryRodentlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryRodentlocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryRodentlocation has methods that act as mods for the HistoryRodentlocationTemplate +var HistoryRodentlocationMods historyRodentlocationMods + +type historyRodentlocationMods struct{} + +func (m historyRodentlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModSlice{ + HistoryRodentlocationMods.RandomOrganizationID(f), + HistoryRodentlocationMods.RandomAccessdesc(f), + HistoryRodentlocationMods.RandomActive(f), + HistoryRodentlocationMods.RandomComments(f), + HistoryRodentlocationMods.RandomCreationdate(f), + HistoryRodentlocationMods.RandomCreator(f), + HistoryRodentlocationMods.RandomDescription(f), + HistoryRodentlocationMods.RandomExternalid(f), + HistoryRodentlocationMods.RandomEditdate(f), + HistoryRodentlocationMods.RandomEditor(f), + HistoryRodentlocationMods.RandomGlobalid(f), + HistoryRodentlocationMods.RandomHabitat(f), + HistoryRodentlocationMods.RandomLastinspectaction(f), + HistoryRodentlocationMods.RandomLastinspectconditions(f), + HistoryRodentlocationMods.RandomLastinspectdate(f), + HistoryRodentlocationMods.RandomLastinspectrodentevidence(f), + HistoryRodentlocationMods.RandomLastinspectspecies(f), + HistoryRodentlocationMods.RandomLocationname(f), + HistoryRodentlocationMods.RandomLocationnumber(f), + HistoryRodentlocationMods.RandomNextactiondatescheduled(f), + HistoryRodentlocationMods.RandomObjectid(f), + HistoryRodentlocationMods.RandomPriority(f), + HistoryRodentlocationMods.RandomSymbology(f), + HistoryRodentlocationMods.RandomUsetype(f), + HistoryRodentlocationMods.RandomZone(f), + HistoryRodentlocationMods.RandomZone2(f), + HistoryRodentlocationMods.RandomCreatedDate(f), + HistoryRodentlocationMods.RandomCreatedUser(f), + HistoryRodentlocationMods.RandomGeometryX(f), + HistoryRodentlocationMods.RandomGeometryY(f), + HistoryRodentlocationMods.RandomLastEditedDate(f), + HistoryRodentlocationMods.RandomLastEditedUser(f), + HistoryRodentlocationMods.RandomJurisdiction(f), + HistoryRodentlocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyRodentlocationMods) OrganizationID(val null.Val[int32]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetOrganizationID() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Accessdesc(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetAccessdesc() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Accessdesc = 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) RandomAccessdesc(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Active(val null.Val[int16]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetActive() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Active = 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) RandomActive(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Comments(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CommentsFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetComments() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Creationdate(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetCreationdate() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Creator(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CreatorFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetCreator() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Description(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetDescription() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Description = 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) RandomDescription(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Externalid(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetExternalid() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Editdate(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetEditdate() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Editor(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) EditorFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetEditor() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Globalid(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetGlobalid() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Habitat(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) HabitatFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetHabitat() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Habitat = 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) RandomHabitat(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Lastinspectaction(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastinspectactionFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectaction = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastinspectaction() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectaction = 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) RandomLastinspectaction(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectactionNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Lastinspectconditions(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectconditions = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastinspectconditions() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectconditions = 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) RandomLastinspectconditions(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectconditions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Lastinspectdate(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectdate = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastinspectdate() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectdate = 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) RandomLastinspectdate(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Lastinspectrodentevidence(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastinspectrodentevidenceFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectrodentevidence = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastinspectrodentevidence() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectrodentevidence = 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) RandomLastinspectrodentevidence(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectrodentevidenceNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectrodentevidence = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Lastinspectspecies(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastinspectspeciesFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectspecies = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastinspectspecies() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectspecies = 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) RandomLastinspectspecies(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastinspectspeciesNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Lastinspectspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Locationname(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LocationnameFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLocationname() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Locationnumber(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLocationnumber() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationnumber = 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) RandomLocationnumber(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetNextactiondatescheduled() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Nextactiondatescheduled = 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) RandomNextactiondatescheduled(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Objectid(val int32) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) ObjectidFunc(f func() int32) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetObjectid() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyRodentlocationMods) RandomObjectid(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Priority(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) PriorityFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetPriority() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Priority = 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) RandomPriority(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Symbology(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetSymbology() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Symbology = 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) RandomSymbology(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Usetype(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetUsetype() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Usetype = 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) RandomUsetype(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Zone(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) ZoneFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetZone() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Zone2(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) Zone2Func(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetZone2() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetCreatedDate() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) CreatedUser(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetCreatedUser() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) GeometryX(val null.Val[float64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetGeometryX() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) GeometryY(val null.Val[float64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetGeometryY() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) LastEditedDate(val null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastEditedDate() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) LastEditedUser(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetLastEditedUser() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Jurisdiction(val null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetJurisdiction() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Jurisdiction = 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) RandomJurisdiction(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyRodentlocationMods) Version(val int32) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) VersionFunc(f func() int32) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetVersion() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyRodentlocationMods) RandomVersion(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyRodentlocationMods) WithParentsCascading() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { + if isDone, _ := historyRodentlocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyRodentlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyRodentlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { + o.r.Organization = &historyRodentlocationROrganizationR{ + o: rel, + } + }) +} + +func (m historyRodentlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyRodentlocationMods) WithExistingOrganization(em *models.Organization) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { + o.r.Organization = &historyRodentlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyRodentlocationMods) WithoutOrganization() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_samplecollection.bob.go b/factory/history_samplecollection.bob.go new file mode 100644 index 00000000..e652835b --- /dev/null +++ b/factory/history_samplecollection.bob.go @@ -0,0 +1,3347 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistorySamplecollectionMod interface { + Apply(context.Context, *HistorySamplecollectionTemplate) +} + +type HistorySamplecollectionModFunc func(context.Context, *HistorySamplecollectionTemplate) + +func (f HistorySamplecollectionModFunc) Apply(ctx context.Context, n *HistorySamplecollectionTemplate) { + f(ctx, n) +} + +type HistorySamplecollectionModSlice []HistorySamplecollectionMod + +func (mods HistorySamplecollectionModSlice) Apply(ctx context.Context, n *HistorySamplecollectionTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Avetemp func() null.Val[float64] + Chickenid func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datesent func() null.Val[int64] + Datetested func() null.Val[int64] + Diseasepos func() null.Val[string] + Diseasetested func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Flockid func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Lab func() null.Val[string] + Locationname func() null.Val[string] + LocID func() null.Val[string] + Objectid func() int32 + Processed func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Samplecond func() null.Val[string] + Samplecount func() null.Val[int16] + Sampleid func() null.Val[string] + Sampletype func() null.Val[string] + Sex func() null.Val[string] + Sitecond func() null.Val[string] + Species func() null.Val[string] + Startdatetime func() null.Val[int64] + Survtech func() null.Val[string] + Testmethod func() null.Val[string] + Testtech func() null.Val[string] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historySamplecollectionR + f *Factory + + alreadyPersisted bool +} + +type historySamplecollectionR struct { + Organization *historySamplecollectionROrganizationR +} + +type historySamplecollectionROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistorySamplecollectionTemplate +func (o *HistorySamplecollectionTemplate) Apply(ctx context.Context, mods ...HistorySamplecollectionMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistorySamplecollection +// according to the relationships in the template. Nothing is inserted into the db +func (t HistorySamplecollectionTemplate) setModelRels(o *models.HistorySamplecollection) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistorySamplecollectionSetter +// this does nothing with the relationship templates +func (o HistorySamplecollectionTemplate) BuildSetter() *models.HistorySamplecollectionSetter { + m := &models.HistorySamplecollectionSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Chickenid != nil { + val := o.Chickenid() + m.Chickenid = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datesent != nil { + val := o.Datesent() + m.Datesent = omitnull.FromNull(val) + } + if o.Datetested != nil { + val := o.Datetested() + m.Datetested = omitnull.FromNull(val) + } + if o.Diseasepos != nil { + val := o.Diseasepos() + m.Diseasepos = omitnull.FromNull(val) + } + if o.Diseasetested != nil { + val := o.Diseasetested() + m.Diseasetested = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Flockid != nil { + val := o.Flockid() + m.Flockid = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lab != nil { + val := o.Lab() + m.Lab = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LocID != nil { + val := o.LocID() + m.LocID = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Samplecond != nil { + val := o.Samplecond() + m.Samplecond = omitnull.FromNull(val) + } + if o.Samplecount != nil { + val := o.Samplecount() + m.Samplecount = omitnull.FromNull(val) + } + if o.Sampleid != nil { + val := o.Sampleid() + m.Sampleid = omitnull.FromNull(val) + } + if o.Sampletype != nil { + val := o.Sampletype() + m.Sampletype = omitnull.FromNull(val) + } + if o.Sex != nil { + val := o.Sex() + m.Sex = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Survtech != nil { + val := o.Survtech() + m.Survtech = omitnull.FromNull(val) + } + if o.Testmethod != nil { + val := o.Testmethod() + m.Testmethod = omitnull.FromNull(val) + } + if o.Testtech != nil { + val := o.Testtech() + m.Testtech = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistorySamplecollectionSetter +// this does nothing with the relationship templates +func (o HistorySamplecollectionTemplate) BuildManySetter(number int) []*models.HistorySamplecollectionSetter { + m := make([]*models.HistorySamplecollectionSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistorySamplecollection +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySamplecollectionTemplate.Create +func (o HistorySamplecollectionTemplate) Build() *models.HistorySamplecollection { + m := &models.HistorySamplecollection{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Chickenid != nil { + m.Chickenid = o.Chickenid() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datesent != nil { + m.Datesent = o.Datesent() + } + if o.Datetested != nil { + m.Datetested = o.Datetested() + } + if o.Diseasepos != nil { + m.Diseasepos = o.Diseasepos() + } + if o.Diseasetested != nil { + m.Diseasetested = o.Diseasetested() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Flockid != nil { + m.Flockid = o.Flockid() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lab != nil { + m.Lab = o.Lab() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LocID != nil { + m.LocID = o.LocID() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Samplecond != nil { + m.Samplecond = o.Samplecond() + } + if o.Samplecount != nil { + m.Samplecount = o.Samplecount() + } + if o.Sampleid != nil { + m.Sampleid = o.Sampleid() + } + if o.Sampletype != nil { + m.Sampletype = o.Sampletype() + } + if o.Sex != nil { + m.Sex = o.Sex() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Survtech != nil { + m.Survtech = o.Survtech() + } + if o.Testmethod != nil { + m.Testmethod = o.Testmethod() + } + if o.Testtech != nil { + m.Testtech = o.Testtech() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistorySamplecollectionSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySamplecollectionTemplate.CreateMany +func (o HistorySamplecollectionTemplate) BuildMany(number int) models.HistorySamplecollectionSlice { + m := make(models.HistorySamplecollectionSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistorySamplecollection(m *models.HistorySamplecollectionSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistorySamplecollection +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historySamplecollection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistorySamplecollectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySamplecollection, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistorySamplecollection(opt) + + m, err := models.HistorySamplecollections.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historySamplecollection and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistorySamplecollectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySamplecollection { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historySamplecollection 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 *HistorySamplecollectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySamplecollection { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historySamplecollections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistorySamplecollectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySamplecollectionSlice, error) { + var err error + m := make(models.HistorySamplecollectionSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historySamplecollections and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistorySamplecollectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySamplecollectionSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historySamplecollections 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 HistorySamplecollectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySamplecollectionSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistorySamplecollection has methods that act as mods for the HistorySamplecollectionTemplate +var HistorySamplecollectionMods historySamplecollectionMods + +type historySamplecollectionMods struct{} + +func (m historySamplecollectionMods) RandomizeAllColumns(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModSlice{ + HistorySamplecollectionMods.RandomOrganizationID(f), + HistorySamplecollectionMods.RandomActivity(f), + HistorySamplecollectionMods.RandomAvetemp(f), + HistorySamplecollectionMods.RandomChickenid(f), + HistorySamplecollectionMods.RandomComments(f), + HistorySamplecollectionMods.RandomCreationdate(f), + HistorySamplecollectionMods.RandomCreator(f), + HistorySamplecollectionMods.RandomDatesent(f), + HistorySamplecollectionMods.RandomDatetested(f), + HistorySamplecollectionMods.RandomDiseasepos(f), + HistorySamplecollectionMods.RandomDiseasetested(f), + HistorySamplecollectionMods.RandomEnddatetime(f), + HistorySamplecollectionMods.RandomEditdate(f), + HistorySamplecollectionMods.RandomEditor(f), + HistorySamplecollectionMods.RandomFieldtech(f), + HistorySamplecollectionMods.RandomFlockid(f), + HistorySamplecollectionMods.RandomGatewaysync(f), + HistorySamplecollectionMods.RandomGlobalid(f), + HistorySamplecollectionMods.RandomLab(f), + HistorySamplecollectionMods.RandomLocationname(f), + HistorySamplecollectionMods.RandomLocID(f), + HistorySamplecollectionMods.RandomObjectid(f), + HistorySamplecollectionMods.RandomProcessed(f), + HistorySamplecollectionMods.RandomRaingauge(f), + HistorySamplecollectionMods.RandomRecordstatus(f), + HistorySamplecollectionMods.RandomReviewed(f), + HistorySamplecollectionMods.RandomReviewedby(f), + HistorySamplecollectionMods.RandomRevieweddate(f), + HistorySamplecollectionMods.RandomSamplecond(f), + HistorySamplecollectionMods.RandomSamplecount(f), + HistorySamplecollectionMods.RandomSampleid(f), + HistorySamplecollectionMods.RandomSampletype(f), + HistorySamplecollectionMods.RandomSex(f), + HistorySamplecollectionMods.RandomSitecond(f), + HistorySamplecollectionMods.RandomSpecies(f), + HistorySamplecollectionMods.RandomStartdatetime(f), + HistorySamplecollectionMods.RandomSurvtech(f), + HistorySamplecollectionMods.RandomTestmethod(f), + HistorySamplecollectionMods.RandomTesttech(f), + HistorySamplecollectionMods.RandomWinddir(f), + HistorySamplecollectionMods.RandomWindspeed(f), + HistorySamplecollectionMods.RandomZone(f), + HistorySamplecollectionMods.RandomZone2(f), + HistorySamplecollectionMods.RandomCreatedDate(f), + HistorySamplecollectionMods.RandomCreatedUser(f), + HistorySamplecollectionMods.RandomGeometryX(f), + HistorySamplecollectionMods.RandomGeometryY(f), + HistorySamplecollectionMods.RandomLastEditedDate(f), + HistorySamplecollectionMods.RandomLastEditedUser(f), + HistorySamplecollectionMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historySamplecollectionMods) OrganizationID(val null.Val[int32]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetOrganizationID() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Activity(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ActivityFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetActivity() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Activity = 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) RandomActivity(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Avetemp(val null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) AvetempFunc(f func() null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetAvetemp() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Avetemp = 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) RandomAvetemp(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Chickenid(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ChickenidFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Chickenid = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetChickenid() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Chickenid = 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) RandomChickenid(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomChickenidNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Chickenid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Comments(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CommentsFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetComments() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Creationdate(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CreationdateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetCreationdate() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Creator(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CreatorFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetCreator() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Datesent(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) DatesentFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datesent = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetDatesent() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datesent = 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) RandomDatesent(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datesent = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Datetested(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) DatetestedFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datetested = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetDatetested() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datetested = 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) RandomDatetested(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Datetested = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Diseasepos(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasepos = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetDiseasepos() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasepos = 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) RandomDiseasepos(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseaseposNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasepos = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Diseasetested(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasetested = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetDiseasetested() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasetested = 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) RandomDiseasetested(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDiseasetestedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Diseasetested = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Enddatetime(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetEnddatetime() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Enddatetime = 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) RandomEnddatetime(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Editdate(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) EditdateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetEditdate() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Editor(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) EditorFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetEditor() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Fieldtech(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) FieldtechFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetFieldtech() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Flockid(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) FlockidFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Flockid = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetFlockid() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Flockid = 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) RandomFlockid(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFlockidNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Flockid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Gatewaysync(val null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) GatewaysyncFunc(f func() null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetGatewaysync() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Gatewaysync = 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) RandomGatewaysync(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Globalid(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) GlobalidFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetGlobalid() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Lab(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Lab = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) LabFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Lab = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetLab() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Lab = 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) RandomLab(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLabNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Lab = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Locationname(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) LocationnameFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetLocationname() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) LocID(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LocID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) LocIDFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LocID = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetLocID() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LocID = 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) RandomLocID(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocIDNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Objectid(val int32) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ObjectidFunc(f func() int32) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetObjectid() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySamplecollectionMods) RandomObjectid(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Processed(val null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetProcessed() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Raingauge(val null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) RaingaugeFunc(f func() null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetRaingauge() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Raingauge = 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) RandomRaingauge(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Recordstatus(val null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) RecordstatusFunc(f func() null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetRecordstatus() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Recordstatus = 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) RandomRecordstatus(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Reviewed(val null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetReviewed() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewed = 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) RandomReviewed(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Reviewedby(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ReviewedbyFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetReviewedby() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewedby = 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) RandomReviewedby(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Revieweddate(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) RevieweddateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetRevieweddate() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Revieweddate = 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) RandomRevieweddate(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Samplecond(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SamplecondFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecond = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSamplecond() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecond = 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) RandomSamplecond(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSamplecondNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Samplecount(val null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SamplecountFunc(f func() null.Val[int16]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecount = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSamplecount() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecount = 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) RandomSamplecount(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomSamplecountNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Samplecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Sampleid(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SampleidFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampleid = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSampleid() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampleid = 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) RandomSampleid(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampleidNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampleid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Sampletype(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SampletypeFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampletype = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSampletype() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampletype = 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) RandomSampletype(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSampletypeNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sampletype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Sex(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sex = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SexFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sex = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSex() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sex = 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) RandomSex(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sex = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSexNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sex = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Sitecond(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SitecondFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSitecond() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sitecond = 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) RandomSitecond(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Species(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SpeciesFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSpecies() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Species = 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) RandomSpecies(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Startdatetime(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetStartdatetime() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Startdatetime = 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) RandomStartdatetime(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Survtech(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) SurvtechFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Survtech = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetSurvtech() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Survtech = 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) RandomSurvtech(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSurvtechNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Survtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Testmethod(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) TestmethodFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testmethod = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetTestmethod() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testmethod = 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) RandomTestmethod(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTestmethodNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testmethod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Testtech(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) TesttechFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testtech = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetTesttech() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testtech = 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) RandomTesttech(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTesttechNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Testtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Winddir(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) WinddirFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetWinddir() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Winddir = 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) RandomWinddir(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Windspeed(val null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) WindspeedFunc(f func() null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetWindspeed() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Windspeed = 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) RandomWindspeed(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Zone(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) ZoneFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetZone() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Zone2(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) Zone2Func(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetZone2() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CreatedDateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetCreatedDate() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) CreatedUser(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CreatedUserFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetCreatedUser() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) GeometryX(val null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) GeometryXFunc(f func() null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetGeometryX() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) GeometryY(val null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) GeometryYFunc(f func() null.Val[float64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetGeometryY() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) LastEditedDate(val null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetLastEditedDate() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) LastEditedUser(val null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) LastEditedUserFunc(f func() null.Val[string]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetLastEditedUser() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplecollectionMods) Version(val int32) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) VersionFunc(f func() int32) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetVersion() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySamplecollectionMods) RandomVersion(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historySamplecollectionMods) WithParentsCascading() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { + if isDone, _ := historySamplecollectionWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historySamplecollectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historySamplecollectionMods) WithOrganization(rel *OrganizationTemplate) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { + o.r.Organization = &historySamplecollectionROrganizationR{ + o: rel, + } + }) +} + +func (m historySamplecollectionMods) WithNewOrganization(mods ...OrganizationMod) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historySamplecollectionMods) WithExistingOrganization(em *models.Organization) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { + o.r.Organization = &historySamplecollectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historySamplecollectionMods) WithoutOrganization() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_samplelocation.bob.go b/factory/history_samplelocation.bob.go new file mode 100644 index 00000000..e4a58586 --- /dev/null +++ b/factory/history_samplelocation.bob.go @@ -0,0 +1,1983 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistorySamplelocationMod interface { + Apply(context.Context, *HistorySamplelocationTemplate) +} + +type HistorySamplelocationModFunc func(context.Context, *HistorySamplelocationTemplate) + +func (f HistorySamplelocationModFunc) Apply(ctx context.Context, n *HistorySamplelocationTemplate) { + f(ctx, n) +} + +type HistorySamplelocationModSlice []HistorySamplelocationMod + +func (mods HistorySamplelocationModSlice) Apply(ctx context.Context, n *HistorySamplelocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historySamplelocationR + f *Factory + + alreadyPersisted bool +} + +type historySamplelocationR struct { + Organization *historySamplelocationROrganizationR +} + +type historySamplelocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistorySamplelocationTemplate +func (o *HistorySamplelocationTemplate) Apply(ctx context.Context, mods ...HistorySamplelocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistorySamplelocation +// according to the relationships in the template. Nothing is inserted into the db +func (t HistorySamplelocationTemplate) setModelRels(o *models.HistorySamplelocation) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistorySamplelocationSetter +// this does nothing with the relationship templates +func (o HistorySamplelocationTemplate) BuildSetter() *models.HistorySamplelocationSetter { + m := &models.HistorySamplelocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistorySamplelocationSetter +// this does nothing with the relationship templates +func (o HistorySamplelocationTemplate) BuildManySetter(number int) []*models.HistorySamplelocationSetter { + m := make([]*models.HistorySamplelocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistorySamplelocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySamplelocationTemplate.Create +func (o HistorySamplelocationTemplate) Build() *models.HistorySamplelocation { + m := &models.HistorySamplelocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistorySamplelocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySamplelocationTemplate.CreateMany +func (o HistorySamplelocationTemplate) BuildMany(number int) models.HistorySamplelocationSlice { + m := make(models.HistorySamplelocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistorySamplelocation(m *models.HistorySamplelocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistorySamplelocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historySamplelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistorySamplelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySamplelocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistorySamplelocation(opt) + + m, err := models.HistorySamplelocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historySamplelocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistorySamplelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySamplelocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historySamplelocation 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 *HistorySamplelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySamplelocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historySamplelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistorySamplelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySamplelocationSlice, error) { + var err error + m := make(models.HistorySamplelocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historySamplelocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistorySamplelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySamplelocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historySamplelocations 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 HistorySamplelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySamplelocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistorySamplelocation has methods that act as mods for the HistorySamplelocationTemplate +var HistorySamplelocationMods historySamplelocationMods + +type historySamplelocationMods struct{} + +func (m historySamplelocationMods) RandomizeAllColumns(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModSlice{ + HistorySamplelocationMods.RandomOrganizationID(f), + HistorySamplelocationMods.RandomAccessdesc(f), + HistorySamplelocationMods.RandomActive(f), + HistorySamplelocationMods.RandomComments(f), + HistorySamplelocationMods.RandomCreationdate(f), + HistorySamplelocationMods.RandomCreator(f), + HistorySamplelocationMods.RandomDescription(f), + HistorySamplelocationMods.RandomExternalid(f), + HistorySamplelocationMods.RandomEditdate(f), + HistorySamplelocationMods.RandomEditor(f), + HistorySamplelocationMods.RandomGatewaysync(f), + HistorySamplelocationMods.RandomGlobalid(f), + HistorySamplelocationMods.RandomHabitat(f), + HistorySamplelocationMods.RandomLocationnumber(f), + HistorySamplelocationMods.RandomName(f), + HistorySamplelocationMods.RandomNextactiondatescheduled(f), + HistorySamplelocationMods.RandomObjectid(f), + HistorySamplelocationMods.RandomPriority(f), + HistorySamplelocationMods.RandomUsetype(f), + HistorySamplelocationMods.RandomZone(f), + HistorySamplelocationMods.RandomZone2(f), + HistorySamplelocationMods.RandomCreatedDate(f), + HistorySamplelocationMods.RandomCreatedUser(f), + HistorySamplelocationMods.RandomGeometryX(f), + HistorySamplelocationMods.RandomGeometryY(f), + HistorySamplelocationMods.RandomLastEditedDate(f), + HistorySamplelocationMods.RandomLastEditedUser(f), + HistorySamplelocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historySamplelocationMods) OrganizationID(val null.Val[int32]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetOrganizationID() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Accessdesc(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) AccessdescFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetAccessdesc() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Accessdesc = 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) RandomAccessdesc(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Active(val null.Val[int16]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) ActiveFunc(f func() null.Val[int16]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetActive() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Active = 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) RandomActive(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Comments(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CommentsFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetComments() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Creationdate(val null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CreationdateFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetCreationdate() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Creator(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CreatorFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetCreator() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Description(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) DescriptionFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetDescription() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Description = 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) RandomDescription(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Externalid(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) ExternalidFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetExternalid() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Editdate(val null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) EditdateFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetEditdate() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Editor(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) EditorFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetEditor() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Gatewaysync(val null.Val[int16]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) GatewaysyncFunc(f func() null.Val[int16]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetGatewaysync() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Gatewaysync = 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) RandomGatewaysync(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Globalid(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) GlobalidFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetGlobalid() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Habitat(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) HabitatFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetHabitat() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Habitat = 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) RandomHabitat(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Locationnumber(val null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) LocationnumberFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetLocationnumber() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Locationnumber = 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) RandomLocationnumber(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Name(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) NameFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetName() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Name = 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) RandomName(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Nextactiondatescheduled(val null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetNextactiondatescheduled() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Nextactiondatescheduled = 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) RandomNextactiondatescheduled(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Objectid(val int32) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) ObjectidFunc(f func() int32) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetObjectid() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySamplelocationMods) RandomObjectid(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Priority(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) PriorityFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetPriority() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Priority = 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) RandomPriority(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Usetype(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) UsetypeFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetUsetype() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Usetype = 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) RandomUsetype(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Zone(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) ZoneFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetZone() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Zone2(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) Zone2Func(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetZone2() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CreatedDateFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetCreatedDate() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) CreatedUser(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CreatedUserFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetCreatedUser() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) GeometryX(val null.Val[float64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) GeometryXFunc(f func() null.Val[float64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetGeometryX() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) GeometryY(val null.Val[float64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) GeometryYFunc(f func() null.Val[float64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetGeometryY() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) LastEditedDate(val null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetLastEditedDate() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) LastEditedUser(val null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) LastEditedUserFunc(f func() null.Val[string]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetLastEditedUser() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySamplelocationMods) Version(val int32) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) VersionFunc(f func() int32) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetVersion() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySamplelocationMods) RandomVersion(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historySamplelocationMods) WithParentsCascading() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { + if isDone, _ := historySamplelocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historySamplelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historySamplelocationMods) WithOrganization(rel *OrganizationTemplate) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { + o.r.Organization = &historySamplelocationROrganizationR{ + o: rel, + } + }) +} + +func (m historySamplelocationMods) WithNewOrganization(mods ...OrganizationMod) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historySamplelocationMods) WithExistingOrganization(em *models.Organization) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { + o.r.Organization = &historySamplelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historySamplelocationMods) WithoutOrganization() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_servicerequest.bob.go b/factory/history_servicerequest.bob.go new file mode 100644 index 00000000..4960af7b --- /dev/null +++ b/factory/history_servicerequest.bob.go @@ -0,0 +1,5827 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryServicerequestMod interface { + Apply(context.Context, *HistoryServicerequestTemplate) +} + +type HistoryServicerequestModFunc func(context.Context, *HistoryServicerequestTemplate) + +func (f HistoryServicerequestModFunc) Apply(ctx context.Context, n *HistoryServicerequestTemplate) { + f(ctx, n) +} + +type HistoryServicerequestModSlice []HistoryServicerequestMod + +func (mods HistoryServicerequestModSlice) Apply(ctx context.Context, n *HistoryServicerequestTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accepted func() null.Val[int16] + Acceptedby func() null.Val[string] + Accepteddate func() null.Val[int64] + Allowed func() null.Val[string] + Assignedtech func() null.Val[string] + Clraddr1 func() null.Val[string] + Clraddr2 func() null.Val[string] + Clranon func() null.Val[int16] + Clrcity func() null.Val[string] + Clrcompany func() null.Val[string] + Clrcontpref func() null.Val[string] + Clremail func() null.Val[string] + Clrfname func() null.Val[string] + Clrother func() null.Val[string] + Clrphone1 func() null.Val[string] + Clrphone2 func() null.Val[string] + Clrstate func() null.Val[string] + Clrzip func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Datetimeclosed func() null.Val[int64] + Duedate func() null.Val[int64] + Entrytech func() null.Val[string] + Estcompletedate func() null.Val[int64] + Externalerror func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Firstresponsedate func() null.Val[int64] + Globalid func() null.Val[string] + Issuesreported func() null.Val[string] + Jurisdiction func() null.Val[string] + Nextaction func() null.Val[string] + Notificationtimestamp func() null.Val[string] + Notified func() null.Val[int16] + Notifieddate func() null.Val[int64] + Objectid func() int32 + Pointlocid func() null.Val[string] + Priority func() null.Val[string] + Recdatetime func() null.Val[int64] + Recordstatus func() null.Val[int16] + Rejectedby func() null.Val[string] + Rejecteddate func() null.Val[int64] + Rejectedreason func() null.Val[string] + Reqaddr1 func() null.Val[string] + Reqaddr2 func() null.Val[string] + Reqcity func() null.Val[string] + Reqcompany func() null.Val[string] + Reqcrossst func() null.Val[string] + Reqdescr func() null.Val[string] + Reqfldnotes func() null.Val[string] + Reqmapgrid func() null.Val[string] + Reqnotesforcust func() null.Val[string] + Reqnotesfortech func() null.Val[string] + Reqpermission func() null.Val[int16] + Reqprogramactions func() null.Val[string] + Reqstate func() null.Val[string] + Reqsubdiv func() null.Val[string] + Reqtarget func() null.Val[string] + Reqzip func() null.Val[string] + Responsedaycount func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Scheduled func() null.Val[int16] + Scheduleddate func() null.Val[int64] + Source func() null.Val[string] + SRNumber func() null.Val[int64] + Status func() null.Val[string] + Supervisor func() null.Val[string] + Techclosed func() null.Val[string] + Validx func() null.Val[string] + Validy func() null.Val[string] + Xvalue func() null.Val[string] + Yvalue func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Dog func() null.Val[int64] + Spanish func() null.Val[int64] + ScheduleNotes func() null.Val[string] + SchedulePeriod func() null.Val[string] + Version func() int32 + + r historyServicerequestR + f *Factory + + alreadyPersisted bool +} + +type historyServicerequestR struct { + Organization *historyServicerequestROrganizationR +} + +type historyServicerequestROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryServicerequestTemplate +func (o *HistoryServicerequestTemplate) Apply(ctx context.Context, mods ...HistoryServicerequestMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryServicerequest +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryServicerequestTemplate) setModelRels(o *models.HistoryServicerequest) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryServicerequestSetter +// this does nothing with the relationship templates +func (o HistoryServicerequestTemplate) BuildSetter() *models.HistoryServicerequestSetter { + m := &models.HistoryServicerequestSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accepted != nil { + val := o.Accepted() + m.Accepted = omitnull.FromNull(val) + } + if o.Acceptedby != nil { + val := o.Acceptedby() + m.Acceptedby = omitnull.FromNull(val) + } + if o.Accepteddate != nil { + val := o.Accepteddate() + m.Accepteddate = omitnull.FromNull(val) + } + if o.Allowed != nil { + val := o.Allowed() + m.Allowed = omitnull.FromNull(val) + } + if o.Assignedtech != nil { + val := o.Assignedtech() + m.Assignedtech = omitnull.FromNull(val) + } + if o.Clraddr1 != nil { + val := o.Clraddr1() + m.Clraddr1 = omitnull.FromNull(val) + } + if o.Clraddr2 != nil { + val := o.Clraddr2() + m.Clraddr2 = omitnull.FromNull(val) + } + if o.Clranon != nil { + val := o.Clranon() + m.Clranon = omitnull.FromNull(val) + } + if o.Clrcity != nil { + val := o.Clrcity() + m.Clrcity = omitnull.FromNull(val) + } + if o.Clrcompany != nil { + val := o.Clrcompany() + m.Clrcompany = omitnull.FromNull(val) + } + if o.Clrcontpref != nil { + val := o.Clrcontpref() + m.Clrcontpref = omitnull.FromNull(val) + } + if o.Clremail != nil { + val := o.Clremail() + m.Clremail = omitnull.FromNull(val) + } + if o.Clrfname != nil { + val := o.Clrfname() + m.Clrfname = omitnull.FromNull(val) + } + if o.Clrother != nil { + val := o.Clrother() + m.Clrother = omitnull.FromNull(val) + } + if o.Clrphone1 != nil { + val := o.Clrphone1() + m.Clrphone1 = omitnull.FromNull(val) + } + if o.Clrphone2 != nil { + val := o.Clrphone2() + m.Clrphone2 = omitnull.FromNull(val) + } + if o.Clrstate != nil { + val := o.Clrstate() + m.Clrstate = omitnull.FromNull(val) + } + if o.Clrzip != nil { + val := o.Clrzip() + m.Clrzip = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Datetimeclosed != nil { + val := o.Datetimeclosed() + m.Datetimeclosed = omitnull.FromNull(val) + } + if o.Duedate != nil { + val := o.Duedate() + m.Duedate = omitnull.FromNull(val) + } + if o.Entrytech != nil { + val := o.Entrytech() + m.Entrytech = omitnull.FromNull(val) + } + if o.Estcompletedate != nil { + val := o.Estcompletedate() + m.Estcompletedate = omitnull.FromNull(val) + } + if o.Externalerror != nil { + val := o.Externalerror() + m.Externalerror = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Firstresponsedate != nil { + val := o.Firstresponsedate() + m.Firstresponsedate = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Issuesreported != nil { + val := o.Issuesreported() + m.Issuesreported = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Nextaction != nil { + val := o.Nextaction() + m.Nextaction = omitnull.FromNull(val) + } + if o.Notificationtimestamp != nil { + val := o.Notificationtimestamp() + m.Notificationtimestamp = omitnull.FromNull(val) + } + if o.Notified != nil { + val := o.Notified() + m.Notified = omitnull.FromNull(val) + } + if o.Notifieddate != nil { + val := o.Notifieddate() + m.Notifieddate = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Recdatetime != nil { + val := o.Recdatetime() + m.Recdatetime = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Rejectedby != nil { + val := o.Rejectedby() + m.Rejectedby = omitnull.FromNull(val) + } + if o.Rejecteddate != nil { + val := o.Rejecteddate() + m.Rejecteddate = omitnull.FromNull(val) + } + if o.Rejectedreason != nil { + val := o.Rejectedreason() + m.Rejectedreason = omitnull.FromNull(val) + } + if o.Reqaddr1 != nil { + val := o.Reqaddr1() + m.Reqaddr1 = omitnull.FromNull(val) + } + if o.Reqaddr2 != nil { + val := o.Reqaddr2() + m.Reqaddr2 = omitnull.FromNull(val) + } + if o.Reqcity != nil { + val := o.Reqcity() + m.Reqcity = omitnull.FromNull(val) + } + if o.Reqcompany != nil { + val := o.Reqcompany() + m.Reqcompany = omitnull.FromNull(val) + } + if o.Reqcrossst != nil { + val := o.Reqcrossst() + m.Reqcrossst = omitnull.FromNull(val) + } + if o.Reqdescr != nil { + val := o.Reqdescr() + m.Reqdescr = omitnull.FromNull(val) + } + if o.Reqfldnotes != nil { + val := o.Reqfldnotes() + m.Reqfldnotes = omitnull.FromNull(val) + } + if o.Reqmapgrid != nil { + val := o.Reqmapgrid() + m.Reqmapgrid = omitnull.FromNull(val) + } + if o.Reqnotesforcust != nil { + val := o.Reqnotesforcust() + m.Reqnotesforcust = omitnull.FromNull(val) + } + if o.Reqnotesfortech != nil { + val := o.Reqnotesfortech() + m.Reqnotesfortech = omitnull.FromNull(val) + } + if o.Reqpermission != nil { + val := o.Reqpermission() + m.Reqpermission = omitnull.FromNull(val) + } + if o.Reqprogramactions != nil { + val := o.Reqprogramactions() + m.Reqprogramactions = omitnull.FromNull(val) + } + if o.Reqstate != nil { + val := o.Reqstate() + m.Reqstate = omitnull.FromNull(val) + } + if o.Reqsubdiv != nil { + val := o.Reqsubdiv() + m.Reqsubdiv = omitnull.FromNull(val) + } + if o.Reqtarget != nil { + val := o.Reqtarget() + m.Reqtarget = omitnull.FromNull(val) + } + if o.Reqzip != nil { + val := o.Reqzip() + m.Reqzip = omitnull.FromNull(val) + } + if o.Responsedaycount != nil { + val := o.Responsedaycount() + m.Responsedaycount = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Scheduled != nil { + val := o.Scheduled() + m.Scheduled = omitnull.FromNull(val) + } + if o.Scheduleddate != nil { + val := o.Scheduleddate() + m.Scheduleddate = omitnull.FromNull(val) + } + if o.Source != nil { + val := o.Source() + m.Source = omitnull.FromNull(val) + } + if o.SRNumber != nil { + val := o.SRNumber() + m.SRNumber = omitnull.FromNull(val) + } + if o.Status != nil { + val := o.Status() + m.Status = omitnull.FromNull(val) + } + if o.Supervisor != nil { + val := o.Supervisor() + m.Supervisor = omitnull.FromNull(val) + } + if o.Techclosed != nil { + val := o.Techclosed() + m.Techclosed = omitnull.FromNull(val) + } + if o.Validx != nil { + val := o.Validx() + m.Validx = omitnull.FromNull(val) + } + if o.Validy != nil { + val := o.Validy() + m.Validy = omitnull.FromNull(val) + } + if o.Xvalue != nil { + val := o.Xvalue() + m.Xvalue = omitnull.FromNull(val) + } + if o.Yvalue != nil { + val := o.Yvalue() + m.Yvalue = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Dog != nil { + val := o.Dog() + m.Dog = omitnull.FromNull(val) + } + if o.Spanish != nil { + val := o.Spanish() + m.Spanish = omitnull.FromNull(val) + } + if o.ScheduleNotes != nil { + val := o.ScheduleNotes() + m.ScheduleNotes = omitnull.FromNull(val) + } + if o.SchedulePeriod != nil { + val := o.SchedulePeriod() + m.SchedulePeriod = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryServicerequestSetter +// this does nothing with the relationship templates +func (o HistoryServicerequestTemplate) BuildManySetter(number int) []*models.HistoryServicerequestSetter { + m := make([]*models.HistoryServicerequestSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryServicerequest +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryServicerequestTemplate.Create +func (o HistoryServicerequestTemplate) Build() *models.HistoryServicerequest { + m := &models.HistoryServicerequest{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accepted != nil { + m.Accepted = o.Accepted() + } + if o.Acceptedby != nil { + m.Acceptedby = o.Acceptedby() + } + if o.Accepteddate != nil { + m.Accepteddate = o.Accepteddate() + } + if o.Allowed != nil { + m.Allowed = o.Allowed() + } + if o.Assignedtech != nil { + m.Assignedtech = o.Assignedtech() + } + if o.Clraddr1 != nil { + m.Clraddr1 = o.Clraddr1() + } + if o.Clraddr2 != nil { + m.Clraddr2 = o.Clraddr2() + } + if o.Clranon != nil { + m.Clranon = o.Clranon() + } + if o.Clrcity != nil { + m.Clrcity = o.Clrcity() + } + if o.Clrcompany != nil { + m.Clrcompany = o.Clrcompany() + } + if o.Clrcontpref != nil { + m.Clrcontpref = o.Clrcontpref() + } + if o.Clremail != nil { + m.Clremail = o.Clremail() + } + if o.Clrfname != nil { + m.Clrfname = o.Clrfname() + } + if o.Clrother != nil { + m.Clrother = o.Clrother() + } + if o.Clrphone1 != nil { + m.Clrphone1 = o.Clrphone1() + } + if o.Clrphone2 != nil { + m.Clrphone2 = o.Clrphone2() + } + if o.Clrstate != nil { + m.Clrstate = o.Clrstate() + } + if o.Clrzip != nil { + m.Clrzip = o.Clrzip() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Datetimeclosed != nil { + m.Datetimeclosed = o.Datetimeclosed() + } + if o.Duedate != nil { + m.Duedate = o.Duedate() + } + if o.Entrytech != nil { + m.Entrytech = o.Entrytech() + } + if o.Estcompletedate != nil { + m.Estcompletedate = o.Estcompletedate() + } + if o.Externalerror != nil { + m.Externalerror = o.Externalerror() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Firstresponsedate != nil { + m.Firstresponsedate = o.Firstresponsedate() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Issuesreported != nil { + m.Issuesreported = o.Issuesreported() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Nextaction != nil { + m.Nextaction = o.Nextaction() + } + if o.Notificationtimestamp != nil { + m.Notificationtimestamp = o.Notificationtimestamp() + } + if o.Notified != nil { + m.Notified = o.Notified() + } + if o.Notifieddate != nil { + m.Notifieddate = o.Notifieddate() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Recdatetime != nil { + m.Recdatetime = o.Recdatetime() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Rejectedby != nil { + m.Rejectedby = o.Rejectedby() + } + if o.Rejecteddate != nil { + m.Rejecteddate = o.Rejecteddate() + } + if o.Rejectedreason != nil { + m.Rejectedreason = o.Rejectedreason() + } + if o.Reqaddr1 != nil { + m.Reqaddr1 = o.Reqaddr1() + } + if o.Reqaddr2 != nil { + m.Reqaddr2 = o.Reqaddr2() + } + if o.Reqcity != nil { + m.Reqcity = o.Reqcity() + } + if o.Reqcompany != nil { + m.Reqcompany = o.Reqcompany() + } + if o.Reqcrossst != nil { + m.Reqcrossst = o.Reqcrossst() + } + if o.Reqdescr != nil { + m.Reqdescr = o.Reqdescr() + } + if o.Reqfldnotes != nil { + m.Reqfldnotes = o.Reqfldnotes() + } + if o.Reqmapgrid != nil { + m.Reqmapgrid = o.Reqmapgrid() + } + if o.Reqnotesforcust != nil { + m.Reqnotesforcust = o.Reqnotesforcust() + } + if o.Reqnotesfortech != nil { + m.Reqnotesfortech = o.Reqnotesfortech() + } + if o.Reqpermission != nil { + m.Reqpermission = o.Reqpermission() + } + if o.Reqprogramactions != nil { + m.Reqprogramactions = o.Reqprogramactions() + } + if o.Reqstate != nil { + m.Reqstate = o.Reqstate() + } + if o.Reqsubdiv != nil { + m.Reqsubdiv = o.Reqsubdiv() + } + if o.Reqtarget != nil { + m.Reqtarget = o.Reqtarget() + } + if o.Reqzip != nil { + m.Reqzip = o.Reqzip() + } + if o.Responsedaycount != nil { + m.Responsedaycount = o.Responsedaycount() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Scheduled != nil { + m.Scheduled = o.Scheduled() + } + if o.Scheduleddate != nil { + m.Scheduleddate = o.Scheduleddate() + } + if o.Source != nil { + m.Source = o.Source() + } + if o.SRNumber != nil { + m.SRNumber = o.SRNumber() + } + if o.Status != nil { + m.Status = o.Status() + } + if o.Supervisor != nil { + m.Supervisor = o.Supervisor() + } + if o.Techclosed != nil { + m.Techclosed = o.Techclosed() + } + if o.Validx != nil { + m.Validx = o.Validx() + } + if o.Validy != nil { + m.Validy = o.Validy() + } + if o.Xvalue != nil { + m.Xvalue = o.Xvalue() + } + if o.Yvalue != nil { + m.Yvalue = o.Yvalue() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Dog != nil { + m.Dog = o.Dog() + } + if o.Spanish != nil { + m.Spanish = o.Spanish() + } + if o.ScheduleNotes != nil { + m.ScheduleNotes = o.ScheduleNotes() + } + if o.SchedulePeriod != nil { + m.SchedulePeriod = o.SchedulePeriod() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryServicerequestSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryServicerequestTemplate.CreateMany +func (o HistoryServicerequestTemplate) BuildMany(number int) models.HistoryServicerequestSlice { + m := make(models.HistoryServicerequestSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryServicerequest(m *models.HistoryServicerequestSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryServicerequest +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyServicerequest and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryServicerequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryServicerequest, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryServicerequest(opt) + + m, err := models.HistoryServicerequests.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyServicerequest and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryServicerequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryServicerequest { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyServicerequest 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 *HistoryServicerequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryServicerequest { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyServicerequests and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryServicerequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryServicerequestSlice, error) { + var err error + m := make(models.HistoryServicerequestSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyServicerequests and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryServicerequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryServicerequestSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyServicerequests 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 HistoryServicerequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryServicerequestSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryServicerequest has methods that act as mods for the HistoryServicerequestTemplate +var HistoryServicerequestMods historyServicerequestMods + +type historyServicerequestMods struct{} + +func (m historyServicerequestMods) RandomizeAllColumns(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModSlice{ + HistoryServicerequestMods.RandomOrganizationID(f), + HistoryServicerequestMods.RandomAccepted(f), + HistoryServicerequestMods.RandomAcceptedby(f), + HistoryServicerequestMods.RandomAccepteddate(f), + HistoryServicerequestMods.RandomAllowed(f), + HistoryServicerequestMods.RandomAssignedtech(f), + HistoryServicerequestMods.RandomClraddr1(f), + HistoryServicerequestMods.RandomClraddr2(f), + HistoryServicerequestMods.RandomClranon(f), + HistoryServicerequestMods.RandomClrcity(f), + HistoryServicerequestMods.RandomClrcompany(f), + HistoryServicerequestMods.RandomClrcontpref(f), + HistoryServicerequestMods.RandomClremail(f), + HistoryServicerequestMods.RandomClrfname(f), + HistoryServicerequestMods.RandomClrother(f), + HistoryServicerequestMods.RandomClrphone1(f), + HistoryServicerequestMods.RandomClrphone2(f), + HistoryServicerequestMods.RandomClrstate(f), + HistoryServicerequestMods.RandomClrzip(f), + HistoryServicerequestMods.RandomComments(f), + HistoryServicerequestMods.RandomCreationdate(f), + HistoryServicerequestMods.RandomCreator(f), + HistoryServicerequestMods.RandomDatetimeclosed(f), + HistoryServicerequestMods.RandomDuedate(f), + HistoryServicerequestMods.RandomEntrytech(f), + HistoryServicerequestMods.RandomEstcompletedate(f), + HistoryServicerequestMods.RandomExternalerror(f), + HistoryServicerequestMods.RandomExternalid(f), + HistoryServicerequestMods.RandomEditdate(f), + HistoryServicerequestMods.RandomEditor(f), + HistoryServicerequestMods.RandomFirstresponsedate(f), + HistoryServicerequestMods.RandomGlobalid(f), + HistoryServicerequestMods.RandomIssuesreported(f), + HistoryServicerequestMods.RandomJurisdiction(f), + HistoryServicerequestMods.RandomNextaction(f), + HistoryServicerequestMods.RandomNotificationtimestamp(f), + HistoryServicerequestMods.RandomNotified(f), + HistoryServicerequestMods.RandomNotifieddate(f), + HistoryServicerequestMods.RandomObjectid(f), + HistoryServicerequestMods.RandomPointlocid(f), + HistoryServicerequestMods.RandomPriority(f), + HistoryServicerequestMods.RandomRecdatetime(f), + HistoryServicerequestMods.RandomRecordstatus(f), + HistoryServicerequestMods.RandomRejectedby(f), + HistoryServicerequestMods.RandomRejecteddate(f), + HistoryServicerequestMods.RandomRejectedreason(f), + HistoryServicerequestMods.RandomReqaddr1(f), + HistoryServicerequestMods.RandomReqaddr2(f), + HistoryServicerequestMods.RandomReqcity(f), + HistoryServicerequestMods.RandomReqcompany(f), + HistoryServicerequestMods.RandomReqcrossst(f), + HistoryServicerequestMods.RandomReqdescr(f), + HistoryServicerequestMods.RandomReqfldnotes(f), + HistoryServicerequestMods.RandomReqmapgrid(f), + HistoryServicerequestMods.RandomReqnotesforcust(f), + HistoryServicerequestMods.RandomReqnotesfortech(f), + HistoryServicerequestMods.RandomReqpermission(f), + HistoryServicerequestMods.RandomReqprogramactions(f), + HistoryServicerequestMods.RandomReqstate(f), + HistoryServicerequestMods.RandomReqsubdiv(f), + HistoryServicerequestMods.RandomReqtarget(f), + HistoryServicerequestMods.RandomReqzip(f), + HistoryServicerequestMods.RandomResponsedaycount(f), + HistoryServicerequestMods.RandomReviewed(f), + HistoryServicerequestMods.RandomReviewedby(f), + HistoryServicerequestMods.RandomRevieweddate(f), + HistoryServicerequestMods.RandomScheduled(f), + HistoryServicerequestMods.RandomScheduleddate(f), + HistoryServicerequestMods.RandomSource(f), + HistoryServicerequestMods.RandomSRNumber(f), + HistoryServicerequestMods.RandomStatus(f), + HistoryServicerequestMods.RandomSupervisor(f), + HistoryServicerequestMods.RandomTechclosed(f), + HistoryServicerequestMods.RandomValidx(f), + HistoryServicerequestMods.RandomValidy(f), + HistoryServicerequestMods.RandomXvalue(f), + HistoryServicerequestMods.RandomYvalue(f), + HistoryServicerequestMods.RandomZone(f), + HistoryServicerequestMods.RandomZone2(f), + HistoryServicerequestMods.RandomCreatedDate(f), + HistoryServicerequestMods.RandomCreatedUser(f), + HistoryServicerequestMods.RandomGeometryX(f), + HistoryServicerequestMods.RandomGeometryY(f), + HistoryServicerequestMods.RandomLastEditedDate(f), + HistoryServicerequestMods.RandomLastEditedUser(f), + HistoryServicerequestMods.RandomDog(f), + HistoryServicerequestMods.RandomSpanish(f), + HistoryServicerequestMods.RandomScheduleNotes(f), + HistoryServicerequestMods.RandomSchedulePeriod(f), + HistoryServicerequestMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyServicerequestMods) OrganizationID(val null.Val[int32]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetOrganizationID() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Accepted(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) AcceptedFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepted = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetAccepted() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepted = 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) RandomAccepted(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomAcceptedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepted = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Acceptedby(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) AcceptedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Acceptedby = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetAcceptedby() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Acceptedby = 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) RandomAcceptedby(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAcceptedbyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Acceptedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Accepteddate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) AccepteddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepteddate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetAccepteddate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepteddate = 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) RandomAccepteddate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomAccepteddateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Accepteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Allowed(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Allowed = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) AllowedFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Allowed = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetAllowed() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Allowed = 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) RandomAllowed(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Allowed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAllowedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Allowed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Assignedtech(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) AssignedtechFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Assignedtech = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetAssignedtech() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Assignedtech = 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) RandomAssignedtech(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAssignedtechNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Assignedtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clraddr1(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Clraddr1Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr1 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClraddr1() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr1 = 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) RandomClraddr1(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClraddr1NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clraddr2(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Clraddr2Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr2 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClraddr2() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr2 = 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) RandomClraddr2(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClraddr2NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clraddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clranon(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClranonFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clranon = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClranon() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clranon = 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) RandomClranon(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomClranonNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clranon = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrcity(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrcityFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcity = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrcity() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcity = 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) RandomClrcity(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcityNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrcompany(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrcompanyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcompany = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrcompany() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcompany = 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) RandomClrcompany(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcompanyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrcontpref(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcontpref = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrcontpref() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcontpref = 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) RandomClrcontpref(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrcontprefNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrcontpref = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clremail(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clremail = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClremailFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clremail = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClremail() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clremail = 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) RandomClremail(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clremail = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClremailNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clremail = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrfname(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrfnameFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrfname = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrfname() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrfname = 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) RandomClrfname(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrfnameNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrfname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrother(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrother = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrotherFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrother = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrother() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrother = 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) RandomClrother(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrother = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrotherNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrother = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrphone1(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Clrphone1Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone1 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrphone1() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone1 = 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) RandomClrphone1(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrphone1NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrphone2(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Clrphone2Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone2 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrphone2() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone2 = 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) RandomClrphone2(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrphone2NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrphone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrstate(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrstateFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrstate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrstate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrstate = 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) RandomClrstate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrstateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Clrzip(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ClrzipFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrzip = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetClrzip() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrzip = 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) RandomClrzip(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomClrzipNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Clrzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Comments(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CommentsFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetComments() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Creationdate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CreationdateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetCreationdate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Creator(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CreatorFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetCreator() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Datetimeclosed(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) DatetimeclosedFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Datetimeclosed = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetDatetimeclosed() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Datetimeclosed = 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) RandomDatetimeclosed(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDatetimeclosedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Datetimeclosed = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Duedate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) DuedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Duedate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetDuedate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Duedate = 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) RandomDuedate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Duedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Entrytech(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) EntrytechFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Entrytech = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetEntrytech() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Entrytech = 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) RandomEntrytech(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEntrytechNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Entrytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Estcompletedate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) EstcompletedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Estcompletedate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetEstcompletedate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Estcompletedate = 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) RandomEstcompletedate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEstcompletedateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Estcompletedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Externalerror(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ExternalerrorFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalerror = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetExternalerror() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalerror = 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) RandomExternalerror(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalerrorNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalerror = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Externalid(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ExternalidFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetExternalid() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Editdate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) EditdateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetEditdate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Editor(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) EditorFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetEditor() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Firstresponsedate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) FirstresponsedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Firstresponsedate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetFirstresponsedate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Firstresponsedate = 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) RandomFirstresponsedate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFirstresponsedateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Firstresponsedate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Globalid(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) GlobalidFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetGlobalid() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Issuesreported(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Issuesreported = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetIssuesreported() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Issuesreported = 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) RandomIssuesreported(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIssuesreportedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Issuesreported = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Jurisdiction(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) JurisdictionFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetJurisdiction() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Jurisdiction = 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) RandomJurisdiction(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Nextaction(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) NextactionFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Nextaction = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetNextaction() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Nextaction = 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) RandomNextaction(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNextactionNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Nextaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Notificationtimestamp(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) NotificationtimestampFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notificationtimestamp = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetNotificationtimestamp() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notificationtimestamp = 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) RandomNotificationtimestamp(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNotificationtimestampNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notificationtimestamp = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Notified(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notified = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) NotifiedFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notified = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetNotified() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notified = 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) RandomNotified(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Notifieddate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) NotifieddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notifieddate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetNotifieddate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notifieddate = 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) RandomNotifieddate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNotifieddateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Notifieddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Objectid(val int32) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ObjectidFunc(f func() int32) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetObjectid() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyServicerequestMods) RandomObjectid(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Pointlocid(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) PointlocidFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetPointlocid() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Pointlocid = 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) RandomPointlocid(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Priority(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) PriorityFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetPriority() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Priority = 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) RandomPriority(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Recdatetime(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RecdatetimeFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recdatetime = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRecdatetime() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recdatetime = 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) RandomRecdatetime(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRecdatetimeNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Recordstatus(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RecordstatusFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRecordstatus() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recordstatus = 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) RandomRecordstatus(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Rejectedby(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RejectedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedby = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRejectedby() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedby = 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) RandomRejectedby(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRejectedbyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Rejecteddate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RejecteddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejecteddate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRejecteddate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejecteddate = 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) RandomRejecteddate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRejecteddateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejecteddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Rejectedreason(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedreason = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRejectedreason() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedreason = 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) RandomRejectedreason(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRejectedreasonNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Rejectedreason = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqaddr1(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Reqaddr1Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr1 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqaddr1() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr1 = 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) RandomReqaddr1(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqaddr1NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr1 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqaddr2(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Reqaddr2Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr2 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqaddr2() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr2 = 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) RandomReqaddr2(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqaddr2NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqaddr2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqcity(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqcityFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcity = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqcity() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcity = 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) RandomReqcity(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcityNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqcompany(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqcompanyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcompany = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqcompany() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcompany = 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) RandomReqcompany(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcompanyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcompany = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqcrossst(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqcrossstFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcrossst = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqcrossst() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcrossst = 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) RandomReqcrossst(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqcrossstNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqcrossst = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqdescr(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqdescrFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqdescr = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqdescr() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqdescr = 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) RandomReqdescr(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqdescrNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqdescr = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqfldnotes(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqfldnotesFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqfldnotes = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqfldnotes() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqfldnotes = 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) RandomReqfldnotes(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqfldnotesNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqfldnotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqmapgrid(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqmapgridFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqmapgrid = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqmapgrid() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqmapgrid = 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) RandomReqmapgrid(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqmapgridNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqmapgrid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqnotesforcust(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqnotesforcustFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesforcust = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqnotesforcust() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesforcust = 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) RandomReqnotesforcust(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqnotesforcustNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesforcust = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqnotesfortech(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqnotesfortechFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesfortech = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqnotesfortech() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesfortech = 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) RandomReqnotesfortech(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqnotesfortechNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqnotesfortech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqpermission(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqpermission = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqpermission() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqpermission = 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) RandomReqpermission(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReqpermissionNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqpermission = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqprogramactions(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqprogramactionsFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqprogramactions = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqprogramactions() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqprogramactions = 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) RandomReqprogramactions(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqprogramactionsNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqprogramactions = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqstate(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqstateFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqstate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqstate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqstate = 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) RandomReqstate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqstateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqstate = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqsubdiv(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqsubdivFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqsubdiv = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqsubdiv() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqsubdiv = 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) RandomReqsubdiv(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqsubdivNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqsubdiv = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqtarget(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqtargetFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqtarget = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqtarget() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqtarget = 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) RandomReqtarget(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqtargetNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqtarget = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reqzip(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReqzipFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqzip = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReqzip() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqzip = 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) RandomReqzip(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReqzipNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reqzip = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Responsedaycount(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ResponsedaycountFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Responsedaycount = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetResponsedaycount() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Responsedaycount = 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) RandomResponsedaycount(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomResponsedaycountNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Responsedaycount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reviewed(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReviewedFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReviewed() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewed = 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) RandomReviewed(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Reviewedby(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ReviewedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetReviewedby() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewedby = 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) RandomReviewedby(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Revieweddate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) RevieweddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetRevieweddate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Revieweddate = 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) RandomRevieweddate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Scheduled(val null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ScheduledFunc(f func() null.Val[int16]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduled = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetScheduled() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduled = 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) RandomScheduled(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomScheduledNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduled = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Scheduleddate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ScheduleddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduleddate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetScheduleddate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduleddate = 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) RandomScheduleddate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomScheduleddateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Scheduleddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Source(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Source = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) SourceFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Source = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetSource() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Source = 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) RandomSource(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Source = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSourceNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Source = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) SRNumber(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) SRNumberFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SRNumber = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetSRNumber() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SRNumber = 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) RandomSRNumber(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSRNumberNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SRNumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Status(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Status = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) StatusFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Status = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetStatus() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Status = 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) RandomStatus(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Status = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomStatusNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Status = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Supervisor(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) SupervisorFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Supervisor = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetSupervisor() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Supervisor = 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) RandomSupervisor(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSupervisorNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Supervisor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Techclosed(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) TechclosedFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Techclosed = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetTechclosed() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Techclosed = 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) RandomTechclosed(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTechclosedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Techclosed = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Validx(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validx = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ValidxFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validx = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetValidx() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validx = 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) RandomValidx(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validx = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomValidxNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validx = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Validy(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validy = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ValidyFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validy = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetValidy() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validy = 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) RandomValidy(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validy = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomValidyNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Validy = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Xvalue(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) XvalueFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Xvalue = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetXvalue() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Xvalue = 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) RandomXvalue(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomXvalueNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Xvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Yvalue(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) YvalueFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Yvalue = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetYvalue() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Yvalue = 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) RandomYvalue(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomYvalueNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Yvalue = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Zone(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ZoneFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetZone() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Zone2(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) Zone2Func(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetZone2() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CreatedDateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetCreatedDate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) CreatedUser(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CreatedUserFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetCreatedUser() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) GeometryX(val null.Val[float64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) GeometryXFunc(f func() null.Val[float64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetGeometryX() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) GeometryY(val null.Val[float64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) GeometryYFunc(f func() null.Val[float64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetGeometryY() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) LastEditedDate(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetLastEditedDate() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) LastEditedUser(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) LastEditedUserFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetLastEditedUser() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Dog(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Dog = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) DogFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Dog = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetDog() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Dog = 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) RandomDog(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Dog = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomDogNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Dog = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Spanish(val null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) SpanishFunc(f func() null.Val[int64]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Spanish = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetSpanish() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Spanish = 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) RandomSpanish(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSpanishNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Spanish = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) ScheduleNotes(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) ScheduleNotesFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.ScheduleNotes = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetScheduleNotes() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.ScheduleNotes = 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) RandomScheduleNotes(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomScheduleNotesNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.ScheduleNotes = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) SchedulePeriod(val null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SchedulePeriod = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetSchedulePeriod() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SchedulePeriod = 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) RandomSchedulePeriod(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSchedulePeriodNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.SchedulePeriod = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyServicerequestMods) Version(val int32) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) VersionFunc(f func() int32) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetVersion() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyServicerequestMods) RandomVersion(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyServicerequestMods) WithParentsCascading() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { + if isDone, _ := historyServicerequestWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyServicerequestWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyServicerequestMods) WithOrganization(rel *OrganizationTemplate) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { + o.r.Organization = &historyServicerequestROrganizationR{ + o: rel, + } + }) +} + +func (m historyServicerequestMods) WithNewOrganization(mods ...OrganizationMod) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyServicerequestMods) WithExistingOrganization(em *models.Organization) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { + o.r.Organization = &historyServicerequestROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyServicerequestMods) WithoutOrganization() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_speciesabundance.bob.go b/factory/history_speciesabundance.bob.go new file mode 100644 index 00000000..2e86487a --- /dev/null +++ b/factory/history_speciesabundance.bob.go @@ -0,0 +1,2293 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistorySpeciesabundanceMod interface { + Apply(context.Context, *HistorySpeciesabundanceTemplate) +} + +type HistorySpeciesabundanceModFunc func(context.Context, *HistorySpeciesabundanceTemplate) + +func (f HistorySpeciesabundanceModFunc) Apply(ctx context.Context, n *HistorySpeciesabundanceTemplate) { + f(ctx, n) +} + +type HistorySpeciesabundanceModSlice []HistorySpeciesabundanceMod + +func (mods HistorySpeciesabundanceModSlice) Apply(ctx context.Context, n *HistorySpeciesabundanceTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Bloodedfem func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Eggs func() null.Val[int16] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Females func() null.Val[int64] + Gravidfem func() null.Val[int16] + Globalid func() null.Val[string] + Larvae func() null.Val[int16] + Males func() null.Val[int16] + Objectid func() int32 + Poolstogen func() null.Val[int16] + Processed func() null.Val[int16] + Pupae func() null.Val[int16] + Species func() null.Val[string] + Total func() null.Val[int64] + TrapdataID func() null.Val[string] + Unknown func() null.Val[int16] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Globalzscore func() null.Val[float64] + H3R7 func() null.Val[string] + H3R8 func() null.Val[string] + R7score func() null.Val[float64] + R8score func() null.Val[float64] + Yearweek func() null.Val[int64] + Version func() int32 + + r historySpeciesabundanceR + f *Factory + + alreadyPersisted bool +} + +type historySpeciesabundanceR struct { + Organization *historySpeciesabundanceROrganizationR +} + +type historySpeciesabundanceROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistorySpeciesabundanceTemplate +func (o *HistorySpeciesabundanceTemplate) Apply(ctx context.Context, mods ...HistorySpeciesabundanceMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistorySpeciesabundance +// according to the relationships in the template. Nothing is inserted into the db +func (t HistorySpeciesabundanceTemplate) setModelRels(o *models.HistorySpeciesabundance) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistorySpeciesabundanceSetter +// this does nothing with the relationship templates +func (o HistorySpeciesabundanceTemplate) BuildSetter() *models.HistorySpeciesabundanceSetter { + m := &models.HistorySpeciesabundanceSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Bloodedfem != nil { + val := o.Bloodedfem() + m.Bloodedfem = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Eggs != nil { + val := o.Eggs() + m.Eggs = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Females != nil { + val := o.Females() + m.Females = omitnull.FromNull(val) + } + if o.Gravidfem != nil { + val := o.Gravidfem() + m.Gravidfem = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Larvae != nil { + val := o.Larvae() + m.Larvae = omitnull.FromNull(val) + } + if o.Males != nil { + val := o.Males() + m.Males = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Poolstogen != nil { + val := o.Poolstogen() + m.Poolstogen = omitnull.FromNull(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Pupae != nil { + val := o.Pupae() + m.Pupae = omitnull.FromNull(val) + } + if o.Species != nil { + val := o.Species() + m.Species = omitnull.FromNull(val) + } + if o.Total != nil { + val := o.Total() + m.Total = omitnull.FromNull(val) + } + if o.TrapdataID != nil { + val := o.TrapdataID() + m.TrapdataID = omitnull.FromNull(val) + } + if o.Unknown != nil { + val := o.Unknown() + m.Unknown = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Globalzscore != nil { + val := o.Globalzscore() + m.Globalzscore = omitnull.FromNull(val) + } + if o.H3R7 != nil { + val := o.H3R7() + m.H3R7 = omitnull.FromNull(val) + } + if o.H3R8 != nil { + val := o.H3R8() + m.H3R8 = omitnull.FromNull(val) + } + if o.R7score != nil { + val := o.R7score() + m.R7score = omitnull.FromNull(val) + } + if o.R8score != nil { + val := o.R8score() + m.R8score = omitnull.FromNull(val) + } + if o.Yearweek != nil { + val := o.Yearweek() + m.Yearweek = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistorySpeciesabundanceSetter +// this does nothing with the relationship templates +func (o HistorySpeciesabundanceTemplate) BuildManySetter(number int) []*models.HistorySpeciesabundanceSetter { + m := make([]*models.HistorySpeciesabundanceSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistorySpeciesabundance +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySpeciesabundanceTemplate.Create +func (o HistorySpeciesabundanceTemplate) Build() *models.HistorySpeciesabundance { + m := &models.HistorySpeciesabundance{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Bloodedfem != nil { + m.Bloodedfem = o.Bloodedfem() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Eggs != nil { + m.Eggs = o.Eggs() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Females != nil { + m.Females = o.Females() + } + if o.Gravidfem != nil { + m.Gravidfem = o.Gravidfem() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Larvae != nil { + m.Larvae = o.Larvae() + } + if o.Males != nil { + m.Males = o.Males() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Poolstogen != nil { + m.Poolstogen = o.Poolstogen() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Pupae != nil { + m.Pupae = o.Pupae() + } + if o.Species != nil { + m.Species = o.Species() + } + if o.Total != nil { + m.Total = o.Total() + } + if o.TrapdataID != nil { + m.TrapdataID = o.TrapdataID() + } + if o.Unknown != nil { + m.Unknown = o.Unknown() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Globalzscore != nil { + m.Globalzscore = o.Globalzscore() + } + if o.H3R7 != nil { + m.H3R7 = o.H3R7() + } + if o.H3R8 != nil { + m.H3R8 = o.H3R8() + } + if o.R7score != nil { + m.R7score = o.R7score() + } + if o.R8score != nil { + m.R8score = o.R8score() + } + if o.Yearweek != nil { + m.Yearweek = o.Yearweek() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistorySpeciesabundanceSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistorySpeciesabundanceTemplate.CreateMany +func (o HistorySpeciesabundanceTemplate) BuildMany(number int) models.HistorySpeciesabundanceSlice { + m := make(models.HistorySpeciesabundanceSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistorySpeciesabundance(m *models.HistorySpeciesabundanceSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistorySpeciesabundance +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historySpeciesabundance and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistorySpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySpeciesabundance, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistorySpeciesabundance(opt) + + m, err := models.HistorySpeciesabundances.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historySpeciesabundance and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistorySpeciesabundanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySpeciesabundance { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historySpeciesabundance 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 *HistorySpeciesabundanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySpeciesabundance { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historySpeciesabundances and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistorySpeciesabundanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySpeciesabundanceSlice, error) { + var err error + m := make(models.HistorySpeciesabundanceSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historySpeciesabundances and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistorySpeciesabundanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySpeciesabundanceSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historySpeciesabundances 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 HistorySpeciesabundanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySpeciesabundanceSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistorySpeciesabundance has methods that act as mods for the HistorySpeciesabundanceTemplate +var HistorySpeciesabundanceMods historySpeciesabundanceMods + +type historySpeciesabundanceMods struct{} + +func (m historySpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModSlice{ + HistorySpeciesabundanceMods.RandomOrganizationID(f), + HistorySpeciesabundanceMods.RandomBloodedfem(f), + HistorySpeciesabundanceMods.RandomCreationdate(f), + HistorySpeciesabundanceMods.RandomCreator(f), + HistorySpeciesabundanceMods.RandomEggs(f), + HistorySpeciesabundanceMods.RandomEditdate(f), + HistorySpeciesabundanceMods.RandomEditor(f), + HistorySpeciesabundanceMods.RandomFemales(f), + HistorySpeciesabundanceMods.RandomGravidfem(f), + HistorySpeciesabundanceMods.RandomGlobalid(f), + HistorySpeciesabundanceMods.RandomLarvae(f), + HistorySpeciesabundanceMods.RandomMales(f), + HistorySpeciesabundanceMods.RandomObjectid(f), + HistorySpeciesabundanceMods.RandomPoolstogen(f), + HistorySpeciesabundanceMods.RandomProcessed(f), + HistorySpeciesabundanceMods.RandomPupae(f), + HistorySpeciesabundanceMods.RandomSpecies(f), + HistorySpeciesabundanceMods.RandomTotal(f), + HistorySpeciesabundanceMods.RandomTrapdataID(f), + HistorySpeciesabundanceMods.RandomUnknown(f), + HistorySpeciesabundanceMods.RandomCreatedDate(f), + HistorySpeciesabundanceMods.RandomCreatedUser(f), + HistorySpeciesabundanceMods.RandomGeometryX(f), + HistorySpeciesabundanceMods.RandomGeometryY(f), + HistorySpeciesabundanceMods.RandomLastEditedDate(f), + HistorySpeciesabundanceMods.RandomLastEditedUser(f), + HistorySpeciesabundanceMods.RandomGlobalzscore(f), + HistorySpeciesabundanceMods.RandomH3R7(f), + HistorySpeciesabundanceMods.RandomH3R8(f), + HistorySpeciesabundanceMods.RandomR7score(f), + HistorySpeciesabundanceMods.RandomR8score(f), + HistorySpeciesabundanceMods.RandomYearweek(f), + HistorySpeciesabundanceMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) OrganizationID(val null.Val[int32]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetOrganizationID() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Bloodedfem(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) BloodedfemFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Bloodedfem = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetBloodedfem() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Bloodedfem = 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) RandomBloodedfem(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomBloodedfemNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Bloodedfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Creationdate(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) CreationdateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetCreationdate() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Creator(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) CreatorFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetCreator() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Eggs(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) EggsFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Eggs = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetEggs() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Eggs = 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) RandomEggs(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomEggsNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Eggs = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Editdate(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) EditdateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetEditdate() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Editor(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) EditorFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetEditor() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Females(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) FemalesFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Females = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetFemales() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Females = 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) RandomFemales(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFemalesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Females = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Gravidfem(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) GravidfemFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Gravidfem = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetGravidfem() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Gravidfem = 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) RandomGravidfem(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGravidfemNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Gravidfem = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Globalid(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) GlobalidFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetGlobalid() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Larvae(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) LarvaeFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Larvae = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetLarvae() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Larvae = 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) RandomLarvae(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLarvaeNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Larvae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Males(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) MalesFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Males = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetMales() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Males = 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) RandomMales(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomMalesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Males = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Objectid(val int32) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) ObjectidFunc(f func() int32) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetObjectid() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySpeciesabundanceMods) RandomObjectid(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Poolstogen(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) PoolstogenFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Poolstogen = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetPoolstogen() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Poolstogen = 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) RandomPoolstogen(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPoolstogenNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Poolstogen = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Processed(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetProcessed() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Pupae(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) PupaeFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Pupae = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetPupae() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Pupae = 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) RandomPupae(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomPupaeNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Pupae = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Species(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) SpeciesFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Species = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetSpecies() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Species = 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) RandomSpecies(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSpeciesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Species = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Total(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) TotalFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Total = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetTotal() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Total = 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) RandomTotal(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomTotalNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Total = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) TrapdataID(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) TrapdataIDFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.TrapdataID = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetTrapdataID() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.TrapdataID = 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) RandomTrapdataID(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapdataIDNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.TrapdataID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Unknown(val null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) UnknownFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Unknown = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetUnknown() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Unknown = 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) RandomUnknown(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomUnknownNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Unknown = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) CreatedDateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetCreatedDate() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) CreatedUser(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) CreatedUserFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetCreatedUser() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) GeometryX(val null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) GeometryXFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetGeometryX() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) GeometryY(val null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) GeometryYFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetGeometryY() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) LastEditedDate(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetLastEditedDate() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) LastEditedUser(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) LastEditedUserFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetLastEditedUser() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Globalzscore(val null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) GlobalzscoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalzscore = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetGlobalzscore() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalzscore = 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) RandomGlobalzscore(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGlobalzscoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Globalzscore = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) H3R7(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) H3R7Func(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R7 = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetH3R7() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R7 = 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) RandomH3R7(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R7NotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) H3R8(val null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) H3R8Func(f func() null.Val[string]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R8 = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetH3R8() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R8 = 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) RandomH3R8(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R8NotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) R7score(val null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) R7scoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R7score = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetR7score() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R7score = 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) RandomR7score(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomR7scoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R7score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) R8score(val null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) R8scoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R8score = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetR8score() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R8score = 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) RandomR8score(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomR8scoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.R8score = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Yearweek(val null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) YearweekFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Yearweek = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetYearweek() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Yearweek = 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) RandomYearweek(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomYearweekNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Yearweek = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historySpeciesabundanceMods) Version(val int32) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) VersionFunc(f func() int32) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetVersion() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historySpeciesabundanceMods) RandomVersion(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historySpeciesabundanceMods) WithParentsCascading() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { + if isDone, _ := historySpeciesabundanceWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historySpeciesabundanceWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historySpeciesabundanceMods) WithOrganization(rel *OrganizationTemplate) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { + o.r.Organization = &historySpeciesabundanceROrganizationR{ + o: rel, + } + }) +} + +func (m historySpeciesabundanceMods) WithNewOrganization(mods ...OrganizationMod) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historySpeciesabundanceMods) WithExistingOrganization(em *models.Organization) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { + o.r.Organization = &historySpeciesabundanceROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historySpeciesabundanceMods) WithoutOrganization() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_stormdrain.bob.go b/factory/history_stormdrain.bob.go new file mode 100644 index 00000000..e502564e --- /dev/null +++ b/factory/history_stormdrain.bob.go @@ -0,0 +1,1673 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryStormdrainMod interface { + Apply(context.Context, *HistoryStormdrainTemplate) +} + +type HistoryStormdrainModFunc func(context.Context, *HistoryStormdrainTemplate) + +func (f HistoryStormdrainModFunc) Apply(ctx context.Context, n *HistoryStormdrainTemplate) { + f(ctx, n) +} + +type HistoryStormdrainModSlice []HistoryStormdrainMod + +func (mods HistoryStormdrainModSlice) Apply(ctx context.Context, n *HistoryStormdrainTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Jurisdiction func() null.Val[string] + Lastaction func() null.Val[string] + Laststatus func() null.Val[string] + Lasttreatdate func() null.Val[int64] + Nexttreatmentdate func() null.Val[int64] + Objectid func() int32 + Symbology func() null.Val[string] + Type func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyStormdrainR + f *Factory + + alreadyPersisted bool +} + +type historyStormdrainR struct { + Organization *historyStormdrainROrganizationR +} + +type historyStormdrainROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryStormdrainTemplate +func (o *HistoryStormdrainTemplate) Apply(ctx context.Context, mods ...HistoryStormdrainMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryStormdrain +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryStormdrainSetter +// this does nothing with the relationship templates +func (o HistoryStormdrainTemplate) BuildSetter() *models.HistoryStormdrainSetter { + m := &models.HistoryStormdrainSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Jurisdiction != nil { + val := o.Jurisdiction() + m.Jurisdiction = omitnull.FromNull(val) + } + if o.Lastaction != nil { + val := o.Lastaction() + m.Lastaction = omitnull.FromNull(val) + } + if o.Laststatus != nil { + val := o.Laststatus() + m.Laststatus = omitnull.FromNull(val) + } + if o.Lasttreatdate != nil { + val := o.Lasttreatdate() + m.Lasttreatdate = omitnull.FromNull(val) + } + if o.Nexttreatmentdate != nil { + val := o.Nexttreatmentdate() + m.Nexttreatmentdate = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Symbology != nil { + val := o.Symbology() + m.Symbology = omitnull.FromNull(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryStormdrainSetter +// this does nothing with the relationship templates +func (o HistoryStormdrainTemplate) BuildManySetter(number int) []*models.HistoryStormdrainSetter { + m := make([]*models.HistoryStormdrainSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryStormdrain +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryStormdrainTemplate.Create +func (o HistoryStormdrainTemplate) Build() *models.HistoryStormdrain { + m := &models.HistoryStormdrain{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Jurisdiction != nil { + m.Jurisdiction = o.Jurisdiction() + } + if o.Lastaction != nil { + m.Lastaction = o.Lastaction() + } + if o.Laststatus != nil { + m.Laststatus = o.Laststatus() + } + if o.Lasttreatdate != nil { + m.Lasttreatdate = o.Lasttreatdate() + } + if o.Nexttreatmentdate != nil { + m.Nexttreatmentdate = o.Nexttreatmentdate() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Symbology != nil { + m.Symbology = o.Symbology() + } + if o.Type != nil { + m.Type = o.Type() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryStormdrainSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryStormdrainTemplate.CreateMany +func (o HistoryStormdrainTemplate) BuildMany(number int) models.HistoryStormdrainSlice { + m := make(models.HistoryStormdrainSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryStormdrain(m *models.HistoryStormdrainSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryStormdrain +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyStormdrain and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryStormdrain, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryStormdrain(opt) + + m, err := models.HistoryStormdrains.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyStormdrain and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryStormdrainTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryStormdrain { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyStormdrain 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 *HistoryStormdrainTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryStormdrain { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyStormdrains and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryStormdrainTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryStormdrainSlice, error) { + var err error + m := make(models.HistoryStormdrainSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyStormdrains and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryStormdrainTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryStormdrainSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyStormdrains 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 HistoryStormdrainTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryStormdrainSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryStormdrain has methods that act as mods for the HistoryStormdrainTemplate +var HistoryStormdrainMods historyStormdrainMods + +type historyStormdrainMods struct{} + +func (m historyStormdrainMods) RandomizeAllColumns(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModSlice{ + HistoryStormdrainMods.RandomOrganizationID(f), + HistoryStormdrainMods.RandomCreationdate(f), + HistoryStormdrainMods.RandomCreator(f), + HistoryStormdrainMods.RandomEditdate(f), + HistoryStormdrainMods.RandomEditor(f), + HistoryStormdrainMods.RandomGlobalid(f), + HistoryStormdrainMods.RandomJurisdiction(f), + HistoryStormdrainMods.RandomLastaction(f), + HistoryStormdrainMods.RandomLaststatus(f), + HistoryStormdrainMods.RandomLasttreatdate(f), + HistoryStormdrainMods.RandomNexttreatmentdate(f), + HistoryStormdrainMods.RandomObjectid(f), + HistoryStormdrainMods.RandomSymbology(f), + HistoryStormdrainMods.RandomType(f), + HistoryStormdrainMods.RandomZone(f), + HistoryStormdrainMods.RandomZone2(f), + HistoryStormdrainMods.RandomCreatedDate(f), + HistoryStormdrainMods.RandomCreatedUser(f), + HistoryStormdrainMods.RandomGeometryX(f), + HistoryStormdrainMods.RandomGeometryY(f), + HistoryStormdrainMods.RandomLastEditedDate(f), + HistoryStormdrainMods.RandomLastEditedUser(f), + HistoryStormdrainMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyStormdrainMods) OrganizationID(val null.Val[int32]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetOrganizationID() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Creationdate(val null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) CreationdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetCreationdate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Creator(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) CreatorFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetCreator() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Editdate(val null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) EditdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetEditdate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Editor(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) EditorFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetEditor() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Globalid(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) GlobalidFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetGlobalid() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Jurisdiction(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) JurisdictionFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Jurisdiction = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetJurisdiction() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Jurisdiction = 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) RandomJurisdiction(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomJurisdictionNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Jurisdiction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Lastaction(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) LastactionFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lastaction = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetLastaction() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lastaction = 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) RandomLastaction(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastactionNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lastaction = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Laststatus(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) LaststatusFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Laststatus = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetLaststatus() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Laststatus = 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) RandomLaststatus(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLaststatusNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Laststatus = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Lasttreatdate(val null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lasttreatdate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetLasttreatdate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lasttreatdate = 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) RandomLasttreatdate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Lasttreatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Nexttreatmentdate(val null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) NexttreatmentdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Nexttreatmentdate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetNexttreatmentdate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Nexttreatmentdate = 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) RandomNexttreatmentdate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNexttreatmentdateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Nexttreatmentdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Objectid(val int32) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) ObjectidFunc(f func() int32) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetObjectid() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyStormdrainMods) RandomObjectid(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Symbology(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Symbology = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) SymbologyFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Symbology = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetSymbology() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Symbology = 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) RandomSymbology(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSymbologyNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Symbology = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Type(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Type = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) TypeFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetType() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Type = 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) RandomType(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTypeNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Zone(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) ZoneFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetZone() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Zone2(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) Zone2Func(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetZone2() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) CreatedDateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetCreatedDate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) CreatedUser(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) CreatedUserFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetCreatedUser() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) GeometryX(val null.Val[float64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) GeometryXFunc(f func() null.Val[float64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetGeometryX() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) GeometryY(val null.Val[float64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) GeometryYFunc(f func() null.Val[float64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetGeometryY() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) LastEditedDate(val null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetLastEditedDate() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) LastEditedUser(val null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) LastEditedUserFunc(f func() null.Val[string]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetLastEditedUser() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyStormdrainMods) Version(val int32) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) VersionFunc(f func() int32) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetVersion() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyStormdrainMods) RandomVersion(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyStormdrainMods) WithParentsCascading() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { + if isDone, _ := historyStormdrainWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyStormdrainWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyStormdrainMods) WithOrganization(rel *OrganizationTemplate) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { + o.r.Organization = &historyStormdrainROrganizationR{ + o: rel, + } + }) +} + +func (m historyStormdrainMods) WithNewOrganization(mods ...OrganizationMod) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyStormdrainMods) WithExistingOrganization(em *models.Organization) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { + o.r.Organization = &historyStormdrainROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyStormdrainMods) WithoutOrganization() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_timecard.bob.go b/factory/history_timecard.bob.go new file mode 100644 index 00000000..b7ca2cf3 --- /dev/null +++ b/factory/history_timecard.bob.go @@ -0,0 +1,2231 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryTimecardMod interface { + Apply(context.Context, *HistoryTimecardTemplate) +} + +type HistoryTimecardModFunc func(context.Context, *HistoryTimecardTemplate) + +func (f HistoryTimecardModFunc) Apply(ctx context.Context, n *HistoryTimecardTemplate) { + f(ctx, n) +} + +type HistoryTimecardModSlice []HistoryTimecardMod + +func (mods HistoryTimecardModSlice) Apply(ctx context.Context, n *HistoryTimecardTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Equiptype func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Globalid func() null.Val[string] + Lclocid func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Samplelocid func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Traplocid func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Rodentlocid func() null.Val[string] + Version func() int32 + + r historyTimecardR + f *Factory + + alreadyPersisted bool +} + +type historyTimecardR struct { + Organization *historyTimecardROrganizationR +} + +type historyTimecardROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryTimecardTemplate +func (o *HistoryTimecardTemplate) Apply(ctx context.Context, mods ...HistoryTimecardMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryTimecard +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryTimecardSetter +// this does nothing with the relationship templates +func (o HistoryTimecardTemplate) BuildSetter() *models.HistoryTimecardSetter { + m := &models.HistoryTimecardSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Equiptype != nil { + val := o.Equiptype() + m.Equiptype = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Lclocid != nil { + val := o.Lclocid() + m.Lclocid = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Samplelocid != nil { + val := o.Samplelocid() + m.Samplelocid = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Traplocid != nil { + val := o.Traplocid() + m.Traplocid = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Rodentlocid != nil { + val := o.Rodentlocid() + m.Rodentlocid = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryTimecardSetter +// this does nothing with the relationship templates +func (o HistoryTimecardTemplate) BuildManySetter(number int) []*models.HistoryTimecardSetter { + m := make([]*models.HistoryTimecardSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryTimecard +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTimecardTemplate.Create +func (o HistoryTimecardTemplate) Build() *models.HistoryTimecard { + m := &models.HistoryTimecard{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Equiptype != nil { + m.Equiptype = o.Equiptype() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Lclocid != nil { + m.Lclocid = o.Lclocid() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Samplelocid != nil { + m.Samplelocid = o.Samplelocid() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Traplocid != nil { + m.Traplocid = o.Traplocid() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Rodentlocid != nil { + m.Rodentlocid = o.Rodentlocid() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryTimecardSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTimecardTemplate.CreateMany +func (o HistoryTimecardTemplate) BuildMany(number int) models.HistoryTimecardSlice { + m := make(models.HistoryTimecardSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryTimecard(m *models.HistoryTimecardSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryTimecard +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyTimecard and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTimecard, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryTimecard(opt) + + m, err := models.HistoryTimecards.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyTimecard and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryTimecardTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTimecard { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyTimecard 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 *HistoryTimecardTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTimecard { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyTimecards and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryTimecardTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTimecardSlice, error) { + var err error + m := make(models.HistoryTimecardSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyTimecards and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryTimecardTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTimecardSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyTimecards 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 HistoryTimecardTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTimecardSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryTimecard has methods that act as mods for the HistoryTimecardTemplate +var HistoryTimecardMods historyTimecardMods + +type historyTimecardMods struct{} + +func (m historyTimecardMods) RandomizeAllColumns(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModSlice{ + HistoryTimecardMods.RandomOrganizationID(f), + HistoryTimecardMods.RandomActivity(f), + HistoryTimecardMods.RandomComments(f), + HistoryTimecardMods.RandomCreationdate(f), + HistoryTimecardMods.RandomCreator(f), + HistoryTimecardMods.RandomEnddatetime(f), + HistoryTimecardMods.RandomEquiptype(f), + HistoryTimecardMods.RandomExternalid(f), + HistoryTimecardMods.RandomEditdate(f), + HistoryTimecardMods.RandomEditor(f), + HistoryTimecardMods.RandomFieldtech(f), + HistoryTimecardMods.RandomGlobalid(f), + HistoryTimecardMods.RandomLclocid(f), + HistoryTimecardMods.RandomLinelocid(f), + HistoryTimecardMods.RandomLocationname(f), + HistoryTimecardMods.RandomObjectid(f), + HistoryTimecardMods.RandomPointlocid(f), + HistoryTimecardMods.RandomPolygonlocid(f), + HistoryTimecardMods.RandomSamplelocid(f), + HistoryTimecardMods.RandomSrid(f), + HistoryTimecardMods.RandomStartdatetime(f), + HistoryTimecardMods.RandomTraplocid(f), + HistoryTimecardMods.RandomZone(f), + HistoryTimecardMods.RandomZone2(f), + HistoryTimecardMods.RandomCreatedDate(f), + HistoryTimecardMods.RandomCreatedUser(f), + HistoryTimecardMods.RandomGeometryX(f), + HistoryTimecardMods.RandomGeometryY(f), + HistoryTimecardMods.RandomLastEditedDate(f), + HistoryTimecardMods.RandomLastEditedUser(f), + HistoryTimecardMods.RandomRodentlocid(f), + HistoryTimecardMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyTimecardMods) OrganizationID(val null.Val[int32]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetOrganizationID() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Activity(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) ActivityFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetActivity() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Activity = 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) RandomActivity(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Comments(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CommentsFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetComments() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Creationdate(val null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CreationdateFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetCreationdate() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Creator(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CreatorFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetCreator() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Enddatetime(val null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetEnddatetime() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Enddatetime = 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) RandomEnddatetime(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Equiptype(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Equiptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) EquiptypeFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Equiptype = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetEquiptype() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Equiptype = 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) RandomEquiptype(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEquiptypeNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Externalid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) ExternalidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetExternalid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Editdate(val null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) EditdateFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetEditdate() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Editor(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) EditorFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetEditor() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Fieldtech(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) FieldtechFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetFieldtech() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Globalid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) GlobalidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetGlobalid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Lclocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Lclocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) LclocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Lclocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetLclocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Lclocid = 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) RandomLclocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Lclocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLclocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Lclocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Linelocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) LinelocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetLinelocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Linelocid = 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) RandomLinelocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Locationname(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) LocationnameFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetLocationname() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Objectid(val int32) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) ObjectidFunc(f func() int32) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetObjectid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTimecardMods) RandomObjectid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Pointlocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) PointlocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetPointlocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Pointlocid = 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) RandomPointlocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Polygonlocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) PolygonlocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetPolygonlocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Polygonlocid = 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) RandomPolygonlocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Samplelocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) SamplelocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Samplelocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetSamplelocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Samplelocid = 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) RandomSamplelocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSamplelocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Samplelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Srid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) SridFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetSrid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Srid = 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) RandomSrid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Startdatetime(val null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetStartdatetime() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Startdatetime = 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) RandomStartdatetime(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Traplocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Traplocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) TraplocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Traplocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetTraplocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Traplocid = 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) RandomTraplocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Traplocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTraplocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Traplocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Zone(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) ZoneFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetZone() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Zone2(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) Zone2Func(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetZone2() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetCreatedDate() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) CreatedUser(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CreatedUserFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetCreatedUser() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) GeometryX(val null.Val[float64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) GeometryXFunc(f func() null.Val[float64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetGeometryX() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) GeometryY(val null.Val[float64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) GeometryYFunc(f func() null.Val[float64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetGeometryY() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) LastEditedDate(val null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetLastEditedDate() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) LastEditedUser(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetLastEditedUser() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Rodentlocid(val null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) RodentlocidFunc(f func() null.Val[string]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Rodentlocid = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetRodentlocid() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Rodentlocid = 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) RandomRodentlocid(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomRodentlocidNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Rodentlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTimecardMods) Version(val int32) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) VersionFunc(f func() int32) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetVersion() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTimecardMods) RandomVersion(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyTimecardMods) WithParentsCascading() HistoryTimecardMod { + return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { + if isDone, _ := historyTimecardWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyTimecardWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyTimecardMods) WithOrganization(rel *OrganizationTemplate) HistoryTimecardMod { + return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { + o.r.Organization = &historyTimecardROrganizationR{ + o: rel, + } + }) +} + +func (m historyTimecardMods) WithNewOrganization(mods ...OrganizationMod) HistoryTimecardMod { + return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyTimecardMods) WithExistingOrganization(em *models.Organization) HistoryTimecardMod { + return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { + o.r.Organization = &historyTimecardROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyTimecardMods) WithoutOrganization() HistoryTimecardMod { + return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_trapdata.bob.go b/factory/history_trapdata.bob.go new file mode 100644 index 00000000..5cad6b81 --- /dev/null +++ b/factory/history_trapdata.bob.go @@ -0,0 +1,3099 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryTrapdatumMod interface { + Apply(context.Context, *HistoryTrapdatumTemplate) +} + +type HistoryTrapdatumModFunc func(context.Context, *HistoryTrapdatumTemplate) + +func (f HistoryTrapdatumModFunc) Apply(ctx context.Context, n *HistoryTrapdatumTemplate) { + f(ctx, n) +} + +type HistoryTrapdatumModSlice []HistoryTrapdatumMod + +func (mods HistoryTrapdatumModSlice) Apply(ctx context.Context, n *HistoryTrapdatumTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Avetemp func() null.Val[float64] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Field func() null.Val[int64] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Idbytech func() null.Val[string] + Locationname func() null.Val[string] + LocID func() null.Val[string] + LR func() null.Val[int16] + Objectid func() int32 + Processed func() null.Val[int16] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sitecond func() null.Val[string] + Sortbytech func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Trapactivitytype func() null.Val[string] + Trapcondition func() null.Val[string] + Trapnights func() null.Val[int16] + Traptype func() null.Val[string] + Voltage func() null.Val[float64] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Lure func() null.Val[string] + Vectorsurvtrapdataid func() null.Val[string] + Vectorsurvtraplocationid func() null.Val[string] + Version func() int32 + + r historyTrapdatumR + f *Factory + + alreadyPersisted bool +} + +type historyTrapdatumR struct { + Organization *historyTrapdatumROrganizationR +} + +type historyTrapdatumROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryTrapdatumTemplate +func (o *HistoryTrapdatumTemplate) Apply(ctx context.Context, mods ...HistoryTrapdatumMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryTrapdatum +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryTrapdatumSetter +// this does nothing with the relationship templates +func (o HistoryTrapdatumTemplate) BuildSetter() *models.HistoryTrapdatumSetter { + m := &models.HistoryTrapdatumSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Field != nil { + val := o.Field() + m.Field = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Idbytech != nil { + val := o.Idbytech() + m.Idbytech = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.LocID != nil { + val := o.LocID() + m.LocID = omitnull.FromNull(val) + } + if o.LR != nil { + val := o.LR() + m.LR = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Processed != nil { + val := o.Processed() + m.Processed = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Sortbytech != nil { + val := o.Sortbytech() + m.Sortbytech = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Trapactivitytype != nil { + val := o.Trapactivitytype() + m.Trapactivitytype = omitnull.FromNull(val) + } + if o.Trapcondition != nil { + val := o.Trapcondition() + m.Trapcondition = omitnull.FromNull(val) + } + if o.Trapnights != nil { + val := o.Trapnights() + m.Trapnights = omitnull.FromNull(val) + } + if o.Traptype != nil { + val := o.Traptype() + m.Traptype = omitnull.FromNull(val) + } + if o.Voltage != nil { + val := o.Voltage() + m.Voltage = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Lure != nil { + val := o.Lure() + m.Lure = omitnull.FromNull(val) + } + if o.Vectorsurvtrapdataid != nil { + val := o.Vectorsurvtrapdataid() + m.Vectorsurvtrapdataid = omitnull.FromNull(val) + } + if o.Vectorsurvtraplocationid != nil { + val := o.Vectorsurvtraplocationid() + m.Vectorsurvtraplocationid = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryTrapdatumSetter +// this does nothing with the relationship templates +func (o HistoryTrapdatumTemplate) BuildManySetter(number int) []*models.HistoryTrapdatumSetter { + m := make([]*models.HistoryTrapdatumSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryTrapdatum +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTrapdatumTemplate.Create +func (o HistoryTrapdatumTemplate) Build() *models.HistoryTrapdatum { + m := &models.HistoryTrapdatum{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Field != nil { + m.Field = o.Field() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Idbytech != nil { + m.Idbytech = o.Idbytech() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.LocID != nil { + m.LocID = o.LocID() + } + if o.LR != nil { + m.LR = o.LR() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Processed != nil { + m.Processed = o.Processed() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Sortbytech != nil { + m.Sortbytech = o.Sortbytech() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Trapactivitytype != nil { + m.Trapactivitytype = o.Trapactivitytype() + } + if o.Trapcondition != nil { + m.Trapcondition = o.Trapcondition() + } + if o.Trapnights != nil { + m.Trapnights = o.Trapnights() + } + if o.Traptype != nil { + m.Traptype = o.Traptype() + } + if o.Voltage != nil { + m.Voltage = o.Voltage() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Lure != nil { + m.Lure = o.Lure() + } + if o.Vectorsurvtrapdataid != nil { + m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() + } + if o.Vectorsurvtraplocationid != nil { + m.Vectorsurvtraplocationid = o.Vectorsurvtraplocationid() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryTrapdatumSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTrapdatumTemplate.CreateMany +func (o HistoryTrapdatumTemplate) BuildMany(number int) models.HistoryTrapdatumSlice { + m := make(models.HistoryTrapdatumSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryTrapdatum(m *models.HistoryTrapdatumSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryTrapdatum +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyTrapdatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTrapdatum, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryTrapdatum(opt) + + m, err := models.HistoryTrapdata.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyTrapdatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryTrapdatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTrapdatum { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyTrapdatum 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 *HistoryTrapdatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTrapdatum { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyTrapdata and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryTrapdatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTrapdatumSlice, error) { + var err error + m := make(models.HistoryTrapdatumSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyTrapdata and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryTrapdatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTrapdatumSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyTrapdata 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 HistoryTrapdatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTrapdatumSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryTrapdatum has methods that act as mods for the HistoryTrapdatumTemplate +var HistoryTrapdatumMods historyTrapdatumMods + +type historyTrapdatumMods struct{} + +func (m historyTrapdatumMods) RandomizeAllColumns(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModSlice{ + HistoryTrapdatumMods.RandomOrganizationID(f), + HistoryTrapdatumMods.RandomAvetemp(f), + HistoryTrapdatumMods.RandomComments(f), + HistoryTrapdatumMods.RandomCreationdate(f), + HistoryTrapdatumMods.RandomCreator(f), + HistoryTrapdatumMods.RandomEnddatetime(f), + HistoryTrapdatumMods.RandomEditdate(f), + HistoryTrapdatumMods.RandomEditor(f), + HistoryTrapdatumMods.RandomFieldtech(f), + HistoryTrapdatumMods.RandomField(f), + HistoryTrapdatumMods.RandomGatewaysync(f), + HistoryTrapdatumMods.RandomGlobalid(f), + HistoryTrapdatumMods.RandomIdbytech(f), + HistoryTrapdatumMods.RandomLocationname(f), + HistoryTrapdatumMods.RandomLocID(f), + HistoryTrapdatumMods.RandomLR(f), + HistoryTrapdatumMods.RandomObjectid(f), + HistoryTrapdatumMods.RandomProcessed(f), + HistoryTrapdatumMods.RandomRaingauge(f), + HistoryTrapdatumMods.RandomRecordstatus(f), + HistoryTrapdatumMods.RandomReviewed(f), + HistoryTrapdatumMods.RandomReviewedby(f), + HistoryTrapdatumMods.RandomRevieweddate(f), + HistoryTrapdatumMods.RandomSitecond(f), + HistoryTrapdatumMods.RandomSortbytech(f), + HistoryTrapdatumMods.RandomSrid(f), + HistoryTrapdatumMods.RandomStartdatetime(f), + HistoryTrapdatumMods.RandomTrapactivitytype(f), + HistoryTrapdatumMods.RandomTrapcondition(f), + HistoryTrapdatumMods.RandomTrapnights(f), + HistoryTrapdatumMods.RandomTraptype(f), + HistoryTrapdatumMods.RandomVoltage(f), + HistoryTrapdatumMods.RandomWinddir(f), + HistoryTrapdatumMods.RandomWindspeed(f), + HistoryTrapdatumMods.RandomZone(f), + HistoryTrapdatumMods.RandomZone2(f), + HistoryTrapdatumMods.RandomCreatedDate(f), + HistoryTrapdatumMods.RandomCreatedUser(f), + HistoryTrapdatumMods.RandomGeometryX(f), + HistoryTrapdatumMods.RandomGeometryY(f), + HistoryTrapdatumMods.RandomLastEditedDate(f), + HistoryTrapdatumMods.RandomLastEditedUser(f), + HistoryTrapdatumMods.RandomLure(f), + HistoryTrapdatumMods.RandomVectorsurvtrapdataid(f), + HistoryTrapdatumMods.RandomVectorsurvtraplocationid(f), + HistoryTrapdatumMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyTrapdatumMods) OrganizationID(val null.Val[int32]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetOrganizationID() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Avetemp(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) AvetempFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetAvetemp() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Avetemp = 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) RandomAvetemp(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Comments(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CommentsFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetComments() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Creationdate(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CreationdateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetCreationdate() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Creator(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CreatorFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetCreator() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Enddatetime(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetEnddatetime() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Enddatetime = 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) RandomEnddatetime(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Editdate(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) EditdateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetEditdate() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Editor(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) EditorFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetEditor() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Fieldtech(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) FieldtechFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetFieldtech() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Fieldtech = 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) RandomFieldtech(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Field(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Field = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) FieldFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Field = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetField() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Field = 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) RandomField(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Field = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomFieldNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Field = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Gatewaysync(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetGatewaysync() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Gatewaysync = 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) RandomGatewaysync(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Globalid(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) GlobalidFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetGlobalid() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Idbytech(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) IdbytechFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Idbytech = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetIdbytech() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Idbytech = 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) RandomIdbytech(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomIdbytechNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Idbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Locationname(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LocationnameFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLocationname() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Locationname = 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) RandomLocationname(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) LocID(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LocID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LocIDFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LocID = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLocID() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LocID = 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) RandomLocID(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocIDNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LocID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) LR(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LR = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LRFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LR = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLR() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LR = 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) RandomLR(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomLRNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LR = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Objectid(val int32) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) ObjectidFunc(f func() int32) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetObjectid() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTrapdatumMods) RandomObjectid(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Processed(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Processed = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetProcessed() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Processed = 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) RandomProcessed(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Processed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Raingauge(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) RaingaugeFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetRaingauge() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Raingauge = 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) RandomRaingauge(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Recordstatus(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) RecordstatusFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetRecordstatus() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Recordstatus = 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) RandomRecordstatus(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Reviewed(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetReviewed() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewed = 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) RandomReviewed(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Reviewedby(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) ReviewedbyFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetReviewedby() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewedby = 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) RandomReviewedby(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Revieweddate(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) RevieweddateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetRevieweddate() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Revieweddate = 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) RandomRevieweddate(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Sitecond(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) SitecondFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetSitecond() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sitecond = 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) RandomSitecond(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Sortbytech(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) SortbytechFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sortbytech = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetSortbytech() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sortbytech = 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) RandomSortbytech(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSortbytechNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Sortbytech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Srid(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) SridFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetSrid() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Srid = 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) RandomSrid(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Startdatetime(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetStartdatetime() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Startdatetime = 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) RandomStartdatetime(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Trapactivitytype(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapactivitytype = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetTrapactivitytype() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapactivitytype = 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) RandomTrapactivitytype(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapactivitytypeNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapactivitytype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Trapcondition(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapcondition = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetTrapcondition() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapcondition = 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) RandomTrapcondition(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTrapconditionNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapcondition = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Trapnights(val null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) TrapnightsFunc(f func() null.Val[int16]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapnights = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetTrapnights() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapnights = 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) RandomTrapnights(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTrapnightsNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Trapnights = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Traptype(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) TraptypeFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Traptype = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetTraptype() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Traptype = 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) RandomTraptype(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTraptypeNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Traptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Voltage(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) VoltageFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Voltage = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetVoltage() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Voltage = 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) RandomVoltage(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomVoltageNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Voltage = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Winddir(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) WinddirFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetWinddir() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Winddir = 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) RandomWinddir(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Windspeed(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) WindspeedFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetWindspeed() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Windspeed = 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) RandomWindspeed(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Zone(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) ZoneFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetZone() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Zone2(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) Zone2Func(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetZone2() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetCreatedDate() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) CreatedUser(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CreatedUserFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetCreatedUser() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) GeometryX(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) GeometryXFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetGeometryX() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) GeometryY(val null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) GeometryYFunc(f func() null.Val[float64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetGeometryY() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) LastEditedDate(val null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLastEditedDate() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) LastEditedUser(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLastEditedUser() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Lure(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Lure = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) LureFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Lure = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetLure() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Lure = 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) RandomLure(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Lure = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLureNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Lure = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Vectorsurvtrapdataid(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtrapdataid = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetVectorsurvtrapdataid() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtrapdataid = 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) RandomVectorsurvtrapdataid(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtrapdataid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Vectorsurvtraplocationid(val null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) VectorsurvtraplocationidFunc(f func() null.Val[string]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtraplocationid = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetVectorsurvtraplocationid() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtraplocationid = 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) RandomVectorsurvtraplocationid(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvtraplocationidNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Vectorsurvtraplocationid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTrapdatumMods) Version(val int32) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) VersionFunc(f func() int32) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetVersion() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTrapdatumMods) RandomVersion(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyTrapdatumMods) WithParentsCascading() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { + if isDone, _ := historyTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyTrapdatumWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyTrapdatumMods) WithOrganization(rel *OrganizationTemplate) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { + o.r.Organization = &historyTrapdatumROrganizationR{ + o: rel, + } + }) +} + +func (m historyTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyTrapdatumMods) WithExistingOrganization(em *models.Organization) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { + o.r.Organization = &historyTrapdatumROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyTrapdatumMods) WithoutOrganization() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_traplocation.bob.go b/factory/history_traplocation.bob.go new file mode 100644 index 00000000..2bc2c67c --- /dev/null +++ b/factory/history_traplocation.bob.go @@ -0,0 +1,2355 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryTraplocationMod interface { + Apply(context.Context, *HistoryTraplocationTemplate) +} + +type HistoryTraplocationModFunc func(context.Context, *HistoryTraplocationTemplate) + +func (f HistoryTraplocationModFunc) Apply(ctx context.Context, n *HistoryTraplocationTemplate) { + f(ctx, n) +} + +type HistoryTraplocationModSlice []HistoryTraplocationMod + +func (mods HistoryTraplocationModSlice) Apply(ctx context.Context, n *HistoryTraplocationTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Accessdesc func() null.Val[string] + Active func() null.Val[int16] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Description func() null.Val[string] + Externalid func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Gatewaysync func() null.Val[int16] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + Locationnumber func() null.Val[int64] + Name func() null.Val[string] + Nextactiondatescheduled func() null.Val[int64] + Objectid func() int32 + Priority func() null.Val[string] + Usetype func() null.Val[string] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Route func() null.Val[int64] + RouteOrder func() null.Val[int64] + SetDow func() null.Val[int64] + Vectorsurvsiteid func() null.Val[string] + H3R7 func() null.Val[string] + H3R8 func() null.Val[string] + Version func() int32 + + r historyTraplocationR + f *Factory + + alreadyPersisted bool +} + +type historyTraplocationR struct { + Organization *historyTraplocationROrganizationR +} + +type historyTraplocationROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryTraplocationTemplate +func (o *HistoryTraplocationTemplate) Apply(ctx context.Context, mods ...HistoryTraplocationMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryTraplocation +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryTraplocationSetter +// this does nothing with the relationship templates +func (o HistoryTraplocationTemplate) BuildSetter() *models.HistoryTraplocationSetter { + m := &models.HistoryTraplocationSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Accessdesc != nil { + val := o.Accessdesc() + m.Accessdesc = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Description != nil { + val := o.Description() + m.Description = omitnull.FromNull(val) + } + if o.Externalid != nil { + val := o.Externalid() + m.Externalid = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Gatewaysync != nil { + val := o.Gatewaysync() + m.Gatewaysync = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.Locationnumber != nil { + val := o.Locationnumber() + m.Locationnumber = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Nextactiondatescheduled != nil { + val := o.Nextactiondatescheduled() + m.Nextactiondatescheduled = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Priority != nil { + val := o.Priority() + m.Priority = omitnull.FromNull(val) + } + if o.Usetype != nil { + val := o.Usetype() + m.Usetype = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Route != nil { + val := o.Route() + m.Route = omitnull.FromNull(val) + } + if o.RouteOrder != nil { + val := o.RouteOrder() + m.RouteOrder = omitnull.FromNull(val) + } + if o.SetDow != nil { + val := o.SetDow() + m.SetDow = omitnull.FromNull(val) + } + if o.Vectorsurvsiteid != nil { + val := o.Vectorsurvsiteid() + m.Vectorsurvsiteid = omitnull.FromNull(val) + } + if o.H3R7 != nil { + val := o.H3R7() + m.H3R7 = omitnull.FromNull(val) + } + if o.H3R8 != nil { + val := o.H3R8() + m.H3R8 = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryTraplocationSetter +// this does nothing with the relationship templates +func (o HistoryTraplocationTemplate) BuildManySetter(number int) []*models.HistoryTraplocationSetter { + m := make([]*models.HistoryTraplocationSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryTraplocation +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTraplocationTemplate.Create +func (o HistoryTraplocationTemplate) Build() *models.HistoryTraplocation { + m := &models.HistoryTraplocation{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Accessdesc != nil { + m.Accessdesc = o.Accessdesc() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Description != nil { + m.Description = o.Description() + } + if o.Externalid != nil { + m.Externalid = o.Externalid() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Gatewaysync != nil { + m.Gatewaysync = o.Gatewaysync() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.Locationnumber != nil { + m.Locationnumber = o.Locationnumber() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Nextactiondatescheduled != nil { + m.Nextactiondatescheduled = o.Nextactiondatescheduled() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Priority != nil { + m.Priority = o.Priority() + } + if o.Usetype != nil { + m.Usetype = o.Usetype() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Route != nil { + m.Route = o.Route() + } + if o.RouteOrder != nil { + m.RouteOrder = o.RouteOrder() + } + if o.SetDow != nil { + m.SetDow = o.SetDow() + } + if o.Vectorsurvsiteid != nil { + m.Vectorsurvsiteid = o.Vectorsurvsiteid() + } + if o.H3R7 != nil { + m.H3R7 = o.H3R7() + } + if o.H3R8 != nil { + m.H3R8 = o.H3R8() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryTraplocationSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTraplocationTemplate.CreateMany +func (o HistoryTraplocationTemplate) BuildMany(number int) models.HistoryTraplocationSlice { + m := make(models.HistoryTraplocationSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryTraplocation(m *models.HistoryTraplocationSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryTraplocation +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyTraplocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTraplocation, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryTraplocation(opt) + + m, err := models.HistoryTraplocations.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyTraplocation and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryTraplocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTraplocation { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyTraplocation 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 *HistoryTraplocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTraplocation { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyTraplocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryTraplocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTraplocationSlice, error) { + var err error + m := make(models.HistoryTraplocationSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyTraplocations and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryTraplocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTraplocationSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyTraplocations 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 HistoryTraplocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTraplocationSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryTraplocation has methods that act as mods for the HistoryTraplocationTemplate +var HistoryTraplocationMods historyTraplocationMods + +type historyTraplocationMods struct{} + +func (m historyTraplocationMods) RandomizeAllColumns(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModSlice{ + HistoryTraplocationMods.RandomOrganizationID(f), + HistoryTraplocationMods.RandomAccessdesc(f), + HistoryTraplocationMods.RandomActive(f), + HistoryTraplocationMods.RandomComments(f), + HistoryTraplocationMods.RandomCreationdate(f), + HistoryTraplocationMods.RandomCreator(f), + HistoryTraplocationMods.RandomDescription(f), + HistoryTraplocationMods.RandomExternalid(f), + HistoryTraplocationMods.RandomEditdate(f), + HistoryTraplocationMods.RandomEditor(f), + HistoryTraplocationMods.RandomGatewaysync(f), + HistoryTraplocationMods.RandomGlobalid(f), + HistoryTraplocationMods.RandomHabitat(f), + HistoryTraplocationMods.RandomLocationnumber(f), + HistoryTraplocationMods.RandomName(f), + HistoryTraplocationMods.RandomNextactiondatescheduled(f), + HistoryTraplocationMods.RandomObjectid(f), + HistoryTraplocationMods.RandomPriority(f), + HistoryTraplocationMods.RandomUsetype(f), + HistoryTraplocationMods.RandomZone(f), + HistoryTraplocationMods.RandomZone2(f), + HistoryTraplocationMods.RandomCreatedDate(f), + HistoryTraplocationMods.RandomCreatedUser(f), + HistoryTraplocationMods.RandomGeometryX(f), + HistoryTraplocationMods.RandomGeometryY(f), + HistoryTraplocationMods.RandomLastEditedDate(f), + HistoryTraplocationMods.RandomLastEditedUser(f), + HistoryTraplocationMods.RandomRoute(f), + HistoryTraplocationMods.RandomRouteOrder(f), + HistoryTraplocationMods.RandomSetDow(f), + HistoryTraplocationMods.RandomVectorsurvsiteid(f), + HistoryTraplocationMods.RandomH3R7(f), + HistoryTraplocationMods.RandomH3R8(f), + HistoryTraplocationMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyTraplocationMods) OrganizationID(val null.Val[int32]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetOrganizationID() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Accessdesc(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) AccessdescFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Accessdesc = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetAccessdesc() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Accessdesc = 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) RandomAccessdesc(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAccessdescNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Accessdesc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Active(val null.Val[int16]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Active = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) ActiveFunc(f func() null.Val[int16]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetActive() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Active = 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) RandomActive(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomActiveNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Active = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Comments(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CommentsFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetComments() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Creationdate(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetCreationdate() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Creator(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CreatorFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetCreator() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Description(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Description = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) DescriptionFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Description = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetDescription() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Description = 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) RandomDescription(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomDescriptionNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Description = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Externalid(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Externalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) ExternalidFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Externalid = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetExternalid() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Externalid = 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) RandomExternalid(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomExternalidNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Externalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Editdate(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) EditdateFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetEditdate() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Editor(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) EditorFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetEditor() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Gatewaysync(val null.Val[int16]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Gatewaysync = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetGatewaysync() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Gatewaysync = 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) RandomGatewaysync(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Gatewaysync = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Globalid(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) GlobalidFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetGlobalid() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Habitat(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) HabitatFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetHabitat() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Habitat = 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) RandomHabitat(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Locationnumber(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Locationnumber = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetLocationnumber() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Locationnumber = 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) RandomLocationnumber(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Locationnumber = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Name(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) NameFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetName() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Name = 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) RandomName(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Nextactiondatescheduled = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetNextactiondatescheduled() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Nextactiondatescheduled = 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) RandomNextactiondatescheduled(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Nextactiondatescheduled = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Objectid(val int32) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) ObjectidFunc(f func() int32) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetObjectid() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTraplocationMods) RandomObjectid(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Priority(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Priority = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) PriorityFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Priority = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetPriority() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Priority = 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) RandomPriority(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPriorityNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Priority = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Usetype(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Usetype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) UsetypeFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Usetype = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetUsetype() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Usetype = 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) RandomUsetype(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUsetypeNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Usetype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Zone(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) ZoneFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetZone() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone = 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) RandomZone(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Zone2(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) Zone2Func(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetZone2() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone2 = 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) RandomZone2(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetCreatedDate() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) CreatedUser(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetCreatedUser() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) GeometryX(val null.Val[float64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetGeometryX() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) GeometryY(val null.Val[float64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetGeometryY() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) LastEditedDate(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetLastEditedDate() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) LastEditedUser(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetLastEditedUser() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Route(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Route = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) RouteFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Route = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetRoute() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Route = 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) RandomRoute(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Route = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRouteNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Route = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) RouteOrder(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) RouteOrderFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.RouteOrder = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetRouteOrder() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.RouteOrder = 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) RandomRouteOrder(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRouteOrderNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.RouteOrder = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) SetDow(val null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) SetDowFunc(f func() null.Val[int64]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.SetDow = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetSetDow() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.SetDow = 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) RandomSetDow(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomSetDowNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.SetDow = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Vectorsurvsiteid(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) VectorsurvsiteidFunc(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Vectorsurvsiteid = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetVectorsurvsiteid() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Vectorsurvsiteid = 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) RandomVectorsurvsiteid(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomVectorsurvsiteidNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Vectorsurvsiteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) H3R7(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) H3R7Func(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R7 = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetH3R7() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R7 = 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) RandomH3R7(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R7NotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R7 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) H3R8(val null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) H3R8Func(f func() null.Val[string]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R8 = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetH3R8() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R8 = 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) RandomH3R8(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomH3R8NotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.H3R8 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTraplocationMods) Version(val int32) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) VersionFunc(f func() int32) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetVersion() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTraplocationMods) RandomVersion(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyTraplocationMods) WithParentsCascading() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { + if isDone, _ := historyTraplocationWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyTraplocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyTraplocationMods) WithOrganization(rel *OrganizationTemplate) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { + o.r.Organization = &historyTraplocationROrganizationR{ + o: rel, + } + }) +} + +func (m historyTraplocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyTraplocationMods) WithExistingOrganization(em *models.Organization) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { + o.r.Organization = &historyTraplocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyTraplocationMods) WithoutOrganization() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_treatment.bob.go b/factory/history_treatment.bob.go new file mode 100644 index 00000000..70514a65 --- /dev/null +++ b/factory/history_treatment.bob.go @@ -0,0 +1,3843 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryTreatmentMod interface { + Apply(context.Context, *HistoryTreatmentTemplate) +} + +type HistoryTreatmentModFunc func(context.Context, *HistoryTreatmentTemplate) + +func (f HistoryTreatmentModFunc) Apply(ctx context.Context, n *HistoryTreatmentTemplate) { + f(ctx, n) +} + +type HistoryTreatmentModSlice []HistoryTreatmentMod + +func (mods HistoryTreatmentModSlice) Apply(ctx context.Context, n *HistoryTreatmentTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Activity func() null.Val[string] + Areaunit func() null.Val[string] + Avetemp func() null.Val[float64] + Barrierrouteid func() null.Val[string] + Cbcount func() null.Val[int16] + Comments func() null.Val[string] + Containercount func() null.Val[int16] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Enddatetime func() null.Val[int64] + Equiptype func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Fieldtech func() null.Val[string] + Flowrate func() null.Val[float64] + Globalid func() null.Val[string] + Habitat func() null.Val[string] + InspID func() null.Val[string] + Invloc func() null.Val[string] + Linelocid func() null.Val[string] + Locationname func() null.Val[string] + Method func() null.Val[string] + Objectid func() int32 + Pointlocid func() null.Val[string] + Polygonlocid func() null.Val[string] + Product func() null.Val[string] + Ptaid func() null.Val[string] + Qty func() null.Val[float64] + Qtyunit func() null.Val[string] + Raingauge func() null.Val[float64] + Recordstatus func() null.Val[int16] + Reviewed func() null.Val[int16] + Reviewedby func() null.Val[string] + Revieweddate func() null.Val[int64] + Sdid func() null.Val[string] + Sitecond func() null.Val[string] + Srid func() null.Val[string] + Startdatetime func() null.Val[int64] + Targetspecies func() null.Val[string] + Tirecount func() null.Val[int16] + Treatacres func() null.Val[float64] + Treatarea func() null.Val[float64] + Treathectares func() null.Val[float64] + Treatmenthours func() null.Val[float64] + Treatmentlength func() null.Val[float64] + Treatmentlengthunits func() null.Val[string] + Totalcostprodcut func() null.Val[float64] + Ulvrouteid func() null.Val[string] + Warningoverride func() null.Val[int16] + Winddir func() null.Val[string] + Windspeed func() null.Val[float64] + Zone func() null.Val[string] + Zone2 func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + TempSitecond func() null.Val[string] + Version func() int32 + + r historyTreatmentR + f *Factory + + alreadyPersisted bool +} + +type historyTreatmentR struct { + Organization *historyTreatmentROrganizationR +} + +type historyTreatmentROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryTreatmentTemplate +func (o *HistoryTreatmentTemplate) Apply(ctx context.Context, mods ...HistoryTreatmentMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryTreatment +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryTreatmentSetter +// this does nothing with the relationship templates +func (o HistoryTreatmentTemplate) BuildSetter() *models.HistoryTreatmentSetter { + m := &models.HistoryTreatmentSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Activity != nil { + val := o.Activity() + m.Activity = omitnull.FromNull(val) + } + if o.Areaunit != nil { + val := o.Areaunit() + m.Areaunit = omitnull.FromNull(val) + } + if o.Avetemp != nil { + val := o.Avetemp() + m.Avetemp = omitnull.FromNull(val) + } + if o.Barrierrouteid != nil { + val := o.Barrierrouteid() + m.Barrierrouteid = omitnull.FromNull(val) + } + if o.Cbcount != nil { + val := o.Cbcount() + m.Cbcount = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Containercount != nil { + val := o.Containercount() + m.Containercount = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Enddatetime != nil { + val := o.Enddatetime() + m.Enddatetime = omitnull.FromNull(val) + } + if o.Equiptype != nil { + val := o.Equiptype() + m.Equiptype = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Fieldtech != nil { + val := o.Fieldtech() + m.Fieldtech = omitnull.FromNull(val) + } + if o.Flowrate != nil { + val := o.Flowrate() + m.Flowrate = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Habitat != nil { + val := o.Habitat() + m.Habitat = omitnull.FromNull(val) + } + if o.InspID != nil { + val := o.InspID() + m.InspID = omitnull.FromNull(val) + } + if o.Invloc != nil { + val := o.Invloc() + m.Invloc = omitnull.FromNull(val) + } + if o.Linelocid != nil { + val := o.Linelocid() + m.Linelocid = omitnull.FromNull(val) + } + if o.Locationname != nil { + val := o.Locationname() + m.Locationname = omitnull.FromNull(val) + } + if o.Method != nil { + val := o.Method() + m.Method = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.Pointlocid != nil { + val := o.Pointlocid() + m.Pointlocid = omitnull.FromNull(val) + } + if o.Polygonlocid != nil { + val := o.Polygonlocid() + m.Polygonlocid = omitnull.FromNull(val) + } + if o.Product != nil { + val := o.Product() + m.Product = omitnull.FromNull(val) + } + if o.Ptaid != nil { + val := o.Ptaid() + m.Ptaid = omitnull.FromNull(val) + } + if o.Qty != nil { + val := o.Qty() + m.Qty = omitnull.FromNull(val) + } + if o.Qtyunit != nil { + val := o.Qtyunit() + m.Qtyunit = omitnull.FromNull(val) + } + if o.Raingauge != nil { + val := o.Raingauge() + m.Raingauge = omitnull.FromNull(val) + } + if o.Recordstatus != nil { + val := o.Recordstatus() + m.Recordstatus = omitnull.FromNull(val) + } + if o.Reviewed != nil { + val := o.Reviewed() + m.Reviewed = omitnull.FromNull(val) + } + if o.Reviewedby != nil { + val := o.Reviewedby() + m.Reviewedby = omitnull.FromNull(val) + } + if o.Revieweddate != nil { + val := o.Revieweddate() + m.Revieweddate = omitnull.FromNull(val) + } + if o.Sdid != nil { + val := o.Sdid() + m.Sdid = omitnull.FromNull(val) + } + if o.Sitecond != nil { + val := o.Sitecond() + m.Sitecond = omitnull.FromNull(val) + } + if o.Srid != nil { + val := o.Srid() + m.Srid = omitnull.FromNull(val) + } + if o.Startdatetime != nil { + val := o.Startdatetime() + m.Startdatetime = omitnull.FromNull(val) + } + if o.Targetspecies != nil { + val := o.Targetspecies() + m.Targetspecies = omitnull.FromNull(val) + } + if o.Tirecount != nil { + val := o.Tirecount() + m.Tirecount = omitnull.FromNull(val) + } + if o.Treatacres != nil { + val := o.Treatacres() + m.Treatacres = omitnull.FromNull(val) + } + if o.Treatarea != nil { + val := o.Treatarea() + m.Treatarea = omitnull.FromNull(val) + } + if o.Treathectares != nil { + val := o.Treathectares() + m.Treathectares = omitnull.FromNull(val) + } + if o.Treatmenthours != nil { + val := o.Treatmenthours() + m.Treatmenthours = omitnull.FromNull(val) + } + if o.Treatmentlength != nil { + val := o.Treatmentlength() + m.Treatmentlength = omitnull.FromNull(val) + } + if o.Treatmentlengthunits != nil { + val := o.Treatmentlengthunits() + m.Treatmentlengthunits = omitnull.FromNull(val) + } + if o.Totalcostprodcut != nil { + val := o.Totalcostprodcut() + m.Totalcostprodcut = omitnull.FromNull(val) + } + if o.Ulvrouteid != nil { + val := o.Ulvrouteid() + m.Ulvrouteid = omitnull.FromNull(val) + } + if o.Warningoverride != nil { + val := o.Warningoverride() + m.Warningoverride = omitnull.FromNull(val) + } + if o.Winddir != nil { + val := o.Winddir() + m.Winddir = omitnull.FromNull(val) + } + if o.Windspeed != nil { + val := o.Windspeed() + m.Windspeed = omitnull.FromNull(val) + } + if o.Zone != nil { + val := o.Zone() + m.Zone = omitnull.FromNull(val) + } + if o.Zone2 != nil { + val := o.Zone2() + m.Zone2 = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.TempSitecond != nil { + val := o.TempSitecond() + m.TempSitecond = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryTreatmentSetter +// this does nothing with the relationship templates +func (o HistoryTreatmentTemplate) BuildManySetter(number int) []*models.HistoryTreatmentSetter { + m := make([]*models.HistoryTreatmentSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryTreatment +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTreatmentTemplate.Create +func (o HistoryTreatmentTemplate) Build() *models.HistoryTreatment { + m := &models.HistoryTreatment{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Activity != nil { + m.Activity = o.Activity() + } + if o.Areaunit != nil { + m.Areaunit = o.Areaunit() + } + if o.Avetemp != nil { + m.Avetemp = o.Avetemp() + } + if o.Barrierrouteid != nil { + m.Barrierrouteid = o.Barrierrouteid() + } + if o.Cbcount != nil { + m.Cbcount = o.Cbcount() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Containercount != nil { + m.Containercount = o.Containercount() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Enddatetime != nil { + m.Enddatetime = o.Enddatetime() + } + if o.Equiptype != nil { + m.Equiptype = o.Equiptype() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Fieldtech != nil { + m.Fieldtech = o.Fieldtech() + } + if o.Flowrate != nil { + m.Flowrate = o.Flowrate() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Habitat != nil { + m.Habitat = o.Habitat() + } + if o.InspID != nil { + m.InspID = o.InspID() + } + if o.Invloc != nil { + m.Invloc = o.Invloc() + } + if o.Linelocid != nil { + m.Linelocid = o.Linelocid() + } + if o.Locationname != nil { + m.Locationname = o.Locationname() + } + if o.Method != nil { + m.Method = o.Method() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.Pointlocid != nil { + m.Pointlocid = o.Pointlocid() + } + if o.Polygonlocid != nil { + m.Polygonlocid = o.Polygonlocid() + } + if o.Product != nil { + m.Product = o.Product() + } + if o.Ptaid != nil { + m.Ptaid = o.Ptaid() + } + if o.Qty != nil { + m.Qty = o.Qty() + } + if o.Qtyunit != nil { + m.Qtyunit = o.Qtyunit() + } + if o.Raingauge != nil { + m.Raingauge = o.Raingauge() + } + if o.Recordstatus != nil { + m.Recordstatus = o.Recordstatus() + } + if o.Reviewed != nil { + m.Reviewed = o.Reviewed() + } + if o.Reviewedby != nil { + m.Reviewedby = o.Reviewedby() + } + if o.Revieweddate != nil { + m.Revieweddate = o.Revieweddate() + } + if o.Sdid != nil { + m.Sdid = o.Sdid() + } + if o.Sitecond != nil { + m.Sitecond = o.Sitecond() + } + if o.Srid != nil { + m.Srid = o.Srid() + } + if o.Startdatetime != nil { + m.Startdatetime = o.Startdatetime() + } + if o.Targetspecies != nil { + m.Targetspecies = o.Targetspecies() + } + if o.Tirecount != nil { + m.Tirecount = o.Tirecount() + } + if o.Treatacres != nil { + m.Treatacres = o.Treatacres() + } + if o.Treatarea != nil { + m.Treatarea = o.Treatarea() + } + if o.Treathectares != nil { + m.Treathectares = o.Treathectares() + } + if o.Treatmenthours != nil { + m.Treatmenthours = o.Treatmenthours() + } + if o.Treatmentlength != nil { + m.Treatmentlength = o.Treatmentlength() + } + if o.Treatmentlengthunits != nil { + m.Treatmentlengthunits = o.Treatmentlengthunits() + } + if o.Totalcostprodcut != nil { + m.Totalcostprodcut = o.Totalcostprodcut() + } + if o.Ulvrouteid != nil { + m.Ulvrouteid = o.Ulvrouteid() + } + if o.Warningoverride != nil { + m.Warningoverride = o.Warningoverride() + } + if o.Winddir != nil { + m.Winddir = o.Winddir() + } + if o.Windspeed != nil { + m.Windspeed = o.Windspeed() + } + if o.Zone != nil { + m.Zone = o.Zone() + } + if o.Zone2 != nil { + m.Zone2 = o.Zone2() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.TempSitecond != nil { + m.TempSitecond = o.TempSitecond() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryTreatmentSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTreatmentTemplate.CreateMany +func (o HistoryTreatmentTemplate) BuildMany(number int) models.HistoryTreatmentSlice { + m := make(models.HistoryTreatmentSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryTreatment(m *models.HistoryTreatmentSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryTreatment +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyTreatment and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTreatment, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryTreatment(opt) + + m, err := models.HistoryTreatments.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyTreatment and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryTreatmentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTreatment { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyTreatment 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 *HistoryTreatmentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTreatment { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyTreatments and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryTreatmentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTreatmentSlice, error) { + var err error + m := make(models.HistoryTreatmentSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyTreatments and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryTreatmentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTreatmentSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyTreatments 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 HistoryTreatmentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTreatmentSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryTreatment has methods that act as mods for the HistoryTreatmentTemplate +var HistoryTreatmentMods historyTreatmentMods + +type historyTreatmentMods struct{} + +func (m historyTreatmentMods) RandomizeAllColumns(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModSlice{ + HistoryTreatmentMods.RandomOrganizationID(f), + HistoryTreatmentMods.RandomActivity(f), + HistoryTreatmentMods.RandomAreaunit(f), + HistoryTreatmentMods.RandomAvetemp(f), + HistoryTreatmentMods.RandomBarrierrouteid(f), + HistoryTreatmentMods.RandomCbcount(f), + HistoryTreatmentMods.RandomComments(f), + HistoryTreatmentMods.RandomContainercount(f), + HistoryTreatmentMods.RandomCreationdate(f), + HistoryTreatmentMods.RandomCreator(f), + HistoryTreatmentMods.RandomEnddatetime(f), + HistoryTreatmentMods.RandomEquiptype(f), + HistoryTreatmentMods.RandomEditdate(f), + HistoryTreatmentMods.RandomEditor(f), + HistoryTreatmentMods.RandomFieldtech(f), + HistoryTreatmentMods.RandomFlowrate(f), + HistoryTreatmentMods.RandomGlobalid(f), + HistoryTreatmentMods.RandomHabitat(f), + HistoryTreatmentMods.RandomInspID(f), + HistoryTreatmentMods.RandomInvloc(f), + HistoryTreatmentMods.RandomLinelocid(f), + HistoryTreatmentMods.RandomLocationname(f), + HistoryTreatmentMods.RandomMethod(f), + HistoryTreatmentMods.RandomObjectid(f), + HistoryTreatmentMods.RandomPointlocid(f), + HistoryTreatmentMods.RandomPolygonlocid(f), + HistoryTreatmentMods.RandomProduct(f), + HistoryTreatmentMods.RandomPtaid(f), + HistoryTreatmentMods.RandomQty(f), + HistoryTreatmentMods.RandomQtyunit(f), + HistoryTreatmentMods.RandomRaingauge(f), + HistoryTreatmentMods.RandomRecordstatus(f), + HistoryTreatmentMods.RandomReviewed(f), + HistoryTreatmentMods.RandomReviewedby(f), + HistoryTreatmentMods.RandomRevieweddate(f), + HistoryTreatmentMods.RandomSdid(f), + HistoryTreatmentMods.RandomSitecond(f), + HistoryTreatmentMods.RandomSrid(f), + HistoryTreatmentMods.RandomStartdatetime(f), + HistoryTreatmentMods.RandomTargetspecies(f), + HistoryTreatmentMods.RandomTirecount(f), + HistoryTreatmentMods.RandomTreatacres(f), + HistoryTreatmentMods.RandomTreatarea(f), + HistoryTreatmentMods.RandomTreathectares(f), + HistoryTreatmentMods.RandomTreatmenthours(f), + HistoryTreatmentMods.RandomTreatmentlength(f), + HistoryTreatmentMods.RandomTreatmentlengthunits(f), + HistoryTreatmentMods.RandomTotalcostprodcut(f), + HistoryTreatmentMods.RandomUlvrouteid(f), + HistoryTreatmentMods.RandomWarningoverride(f), + HistoryTreatmentMods.RandomWinddir(f), + HistoryTreatmentMods.RandomWindspeed(f), + HistoryTreatmentMods.RandomZone(f), + HistoryTreatmentMods.RandomZone2(f), + HistoryTreatmentMods.RandomGeometryX(f), + HistoryTreatmentMods.RandomGeometryY(f), + HistoryTreatmentMods.RandomTempSitecond(f), + HistoryTreatmentMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyTreatmentMods) OrganizationID(val null.Val[int32]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetOrganizationID() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.OrganizationID = 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 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) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Activity(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Activity = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ActivityFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Activity = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetActivity() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Activity = 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 historyTreatmentMods) RandomActivity(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomActivityNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Activity = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Areaunit(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) AreaunitFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Areaunit = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetAreaunit() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Areaunit = 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 historyTreatmentMods) RandomAreaunit(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomAreaunitNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Areaunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Avetemp(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) AvetempFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Avetemp = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetAvetemp() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Avetemp = 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 historyTreatmentMods) RandomAvetemp(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomAvetempNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Avetemp = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Barrierrouteid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) BarrierrouteidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Barrierrouteid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetBarrierrouteid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Barrierrouteid = 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 historyTreatmentMods) RandomBarrierrouteid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomBarrierrouteidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Barrierrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Cbcount(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) CbcountFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Cbcount = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetCbcount() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Cbcount = 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 historyTreatmentMods) RandomCbcount(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Cbcount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Comments(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) CommentsFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetComments() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Comments = 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 historyTreatmentMods) RandomComments(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Containercount(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ContainercountFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Containercount = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetContainercount() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Containercount = 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 historyTreatmentMods) RandomContainercount(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Containercount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Creationdate(val null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) CreationdateFunc(f func() null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetCreationdate() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creationdate = 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 historyTreatmentMods) RandomCreationdate(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Creator(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) CreatorFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetCreator() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creator = 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 historyTreatmentMods) RandomCreator(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Enddatetime(val null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Enddatetime = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetEnddatetime() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Enddatetime = 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 historyTreatmentMods) RandomEnddatetime(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Enddatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Equiptype(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) EquiptypeFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Equiptype = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetEquiptype() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Equiptype = 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 historyTreatmentMods) RandomEquiptype(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEquiptypeNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Equiptype = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Editdate(val null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) EditdateFunc(f func() null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetEditdate() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editdate = 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 historyTreatmentMods) RandomEditdate(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Editor(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) EditorFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetEditor() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editor = 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 historyTreatmentMods) RandomEditor(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Fieldtech(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) FieldtechFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Fieldtech = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetFieldtech() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Fieldtech = 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 historyTreatmentMods) RandomFieldtech(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomFieldtechNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Fieldtech = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Flowrate(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) FlowrateFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Flowrate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetFlowrate() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Flowrate = 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 historyTreatmentMods) RandomFlowrate(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomFlowrateNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Flowrate = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Globalid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) GlobalidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetGlobalid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Globalid = 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 historyTreatmentMods) RandomGlobalid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Habitat(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Habitat = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) HabitatFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Habitat = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetHabitat() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Habitat = 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 historyTreatmentMods) RandomHabitat(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomHabitatNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Habitat = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) InspID(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.InspID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) InspIDFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.InspID = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetInspID() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.InspID = 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 historyTreatmentMods) RandomInspID(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInspIDNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.InspID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Invloc(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Invloc = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) InvlocFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Invloc = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetInvloc() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Invloc = 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 historyTreatmentMods) RandomInvloc(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Invloc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomInvlocNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Invloc = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Linelocid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) LinelocidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Linelocid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetLinelocid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Linelocid = 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 historyTreatmentMods) RandomLinelocid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLinelocidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Linelocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Locationname(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Locationname = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) LocationnameFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Locationname = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetLocationname() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Locationname = 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 historyTreatmentMods) RandomLocationname(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLocationnameNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Locationname = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Method(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Method = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) MethodFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Method = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetMethod() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Method = 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 historyTreatmentMods) RandomMethod(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomMethodNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Method = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Objectid(val int32) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ObjectidFunc(f func() int32) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetObjectid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTreatmentMods) RandomObjectid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Pointlocid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) PointlocidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Pointlocid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetPointlocid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Pointlocid = 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 historyTreatmentMods) RandomPointlocid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPointlocidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Pointlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Polygonlocid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) PolygonlocidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Polygonlocid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetPolygonlocid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Polygonlocid = 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 historyTreatmentMods) RandomPolygonlocid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPolygonlocidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Polygonlocid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Product(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Product = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ProductFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Product = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetProduct() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Product = 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 historyTreatmentMods) RandomProduct(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Product = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomProductNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Product = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Ptaid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) PtaidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ptaid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetPtaid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ptaid = 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 historyTreatmentMods) RandomPtaid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomPtaidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ptaid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Qty(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qty = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) QtyFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qty = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetQty() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qty = 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 historyTreatmentMods) RandomQty(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomQtyNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qty = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Qtyunit(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) QtyunitFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qtyunit = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetQtyunit() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qtyunit = 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 historyTreatmentMods) RandomQtyunit(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomQtyunitNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Qtyunit = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Raingauge(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) RaingaugeFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Raingauge = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetRaingauge() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Raingauge = 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 historyTreatmentMods) RandomRaingauge(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomRaingaugeNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Raingauge = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Recordstatus(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) RecordstatusFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Recordstatus = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetRecordstatus() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Recordstatus = 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 historyTreatmentMods) RandomRecordstatus(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Recordstatus = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Reviewed(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ReviewedFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewed = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetReviewed() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewed = 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 historyTreatmentMods) RandomReviewed(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewed = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Reviewedby(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ReviewedbyFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewedby = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetReviewedby() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewedby = 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 historyTreatmentMods) RandomReviewedby(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomReviewedbyNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Reviewedby = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Revieweddate(val null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) RevieweddateFunc(f func() null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Revieweddate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetRevieweddate() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Revieweddate = 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 historyTreatmentMods) RandomRevieweddate(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Revieweddate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Sdid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sdid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) SdidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sdid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetSdid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sdid = 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 historyTreatmentMods) RandomSdid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSdidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sdid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Sitecond(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) SitecondFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sitecond = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetSitecond() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sitecond = 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 historyTreatmentMods) RandomSitecond(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSitecondNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Sitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Srid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Srid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) SridFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetSrid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Srid = 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 historyTreatmentMods) RandomSrid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSridNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Srid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Startdatetime(val null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Startdatetime = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetStartdatetime() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Startdatetime = 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 historyTreatmentMods) RandomStartdatetime(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Startdatetime = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Targetspecies(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TargetspeciesFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Targetspecies = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTargetspecies() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Targetspecies = 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 historyTreatmentMods) RandomTargetspecies(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTargetspeciesNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Targetspecies = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Tirecount(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TirecountFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Tirecount = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTirecount() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Tirecount = 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 historyTreatmentMods) RandomTirecount(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Tirecount = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treatacres(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreatacresFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatacres = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreatacres() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatacres = 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 historyTreatmentMods) RandomTreatacres(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatacresNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatacres = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treatarea(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreatareaFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatarea = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreatarea() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatarea = 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 historyTreatmentMods) RandomTreatarea(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatareaNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatarea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treathectares(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreathectaresFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treathectares = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreathectares() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treathectares = 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 historyTreatmentMods) RandomTreathectares(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreathectaresNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treathectares = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treatmenthours(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreatmenthoursFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmenthours = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreatmenthours() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmenthours = 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 historyTreatmentMods) RandomTreatmenthours(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatmenthoursNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmenthours = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treatmentlength(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreatmentlengthFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlength = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreatmentlength() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlength = 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 historyTreatmentMods) RandomTreatmentlength(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTreatmentlengthNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Treatmentlengthunits(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TreatmentlengthunitsFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlengthunits = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTreatmentlengthunits() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlengthunits = 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 historyTreatmentMods) RandomTreatmentlengthunits(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatmentlengthunitsNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Treatmentlengthunits = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Totalcostprodcut(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TotalcostprodcutFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Totalcostprodcut = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTotalcostprodcut() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Totalcostprodcut = 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 historyTreatmentMods) RandomTotalcostprodcut(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomTotalcostprodcutNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Totalcostprodcut = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Ulvrouteid(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) UlvrouteidFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ulvrouteid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetUlvrouteid() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ulvrouteid = 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 historyTreatmentMods) RandomUlvrouteid(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomUlvrouteidNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Ulvrouteid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Warningoverride(val null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Warningoverride = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetWarningoverride() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Warningoverride = 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 historyTreatmentMods) RandomWarningoverride(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomWarningoverrideNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Warningoverride = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Winddir(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Winddir = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) WinddirFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Winddir = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetWinddir() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Winddir = 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 historyTreatmentMods) RandomWinddir(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomWinddirNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Winddir = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Windspeed(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) WindspeedFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Windspeed = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetWindspeed() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Windspeed = 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 historyTreatmentMods) RandomWindspeed(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomWindspeedNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Windspeed = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Zone(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) ZoneFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetZone() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone = 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 historyTreatmentMods) RandomZone(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZoneNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Zone2(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) Zone2Func(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone2 = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetZone2() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone2 = 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 historyTreatmentMods) RandomZone2(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomZone2NotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Zone2 = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) GeometryX(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) GeometryXFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetGeometryX() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryX = 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 historyTreatmentMods) RandomGeometryX(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) GeometryY(val null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) GeometryYFunc(f func() null.Val[float64]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetGeometryY() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryY = 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 historyTreatmentMods) RandomGeometryY(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) TempSitecond(val null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) TempSitecondFunc(f func() null.Val[string]) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.TempSitecond = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetTempSitecond() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.TempSitecond = 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 historyTreatmentMods) RandomTempSitecond(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTempSitecondNotNull(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.TempSitecond = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentMods) Version(val int32) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentMods) VersionFunc(f func() int32) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyTreatmentMods) UnsetVersion() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTreatmentMods) RandomVersion(f *faker.Faker) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyTreatmentMods) WithParentsCascading() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { + if isDone, _ := historyTreatmentWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyTreatmentWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyTreatmentMods) WithOrganization(rel *OrganizationTemplate) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { + o.r.Organization = &historyTreatmentROrganizationR{ + o: rel, + } + }) +} + +func (m historyTreatmentMods) WithNewOrganization(mods ...OrganizationMod) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyTreatmentMods) WithExistingOrganization(em *models.Organization) HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { + o.r.Organization = &historyTreatmentROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyTreatmentMods) WithoutOrganization() HistoryTreatmentMod { + return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_treatmentarea.bob.go b/factory/history_treatmentarea.bob.go new file mode 100644 index 00000000..e694b09e --- /dev/null +++ b/factory/history_treatmentarea.bob.go @@ -0,0 +1,1611 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryTreatmentareaMod interface { + Apply(context.Context, *HistoryTreatmentareaTemplate) +} + +type HistoryTreatmentareaModFunc func(context.Context, *HistoryTreatmentareaTemplate) + +func (f HistoryTreatmentareaModFunc) Apply(ctx context.Context, n *HistoryTreatmentareaTemplate) { + f(ctx, n) +} + +type HistoryTreatmentareaModSlice []HistoryTreatmentareaMod + +func (mods HistoryTreatmentareaModSlice) Apply(ctx context.Context, n *HistoryTreatmentareaTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Comments func() null.Val[string] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Notified func() null.Val[int16] + Objectid func() int32 + SessionID func() null.Val[string] + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + Treatdate func() null.Val[int64] + TreatID func() null.Val[string] + Type func() null.Val[string] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyTreatmentareaR + f *Factory + + alreadyPersisted bool +} + +type historyTreatmentareaR struct { + Organization *historyTreatmentareaROrganizationR +} + +type historyTreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryTreatmentareaTemplate +func (o *HistoryTreatmentareaTemplate) Apply(ctx context.Context, mods ...HistoryTreatmentareaMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryTreatmentarea +// according to the relationships in the template. Nothing is inserted into the db +func (t HistoryTreatmentareaTemplate) setModelRels(o *models.HistoryTreatmentarea) { + 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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryTreatmentareaSetter +// this does nothing with the relationship templates +func (o HistoryTreatmentareaTemplate) BuildSetter() *models.HistoryTreatmentareaSetter { + m := &models.HistoryTreatmentareaSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Comments != nil { + val := o.Comments() + m.Comments = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Notified != nil { + val := o.Notified() + m.Notified = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.SessionID != nil { + val := o.SessionID() + m.SessionID = omitnull.FromNull(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.Treatdate != nil { + val := o.Treatdate() + m.Treatdate = omitnull.FromNull(val) + } + if o.TreatID != nil { + val := o.TreatID() + m.TreatID = omitnull.FromNull(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryTreatmentareaSetter +// this does nothing with the relationship templates +func (o HistoryTreatmentareaTemplate) BuildManySetter(number int) []*models.HistoryTreatmentareaSetter { + m := make([]*models.HistoryTreatmentareaSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryTreatmentarea +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTreatmentareaTemplate.Create +func (o HistoryTreatmentareaTemplate) Build() *models.HistoryTreatmentarea { + m := &models.HistoryTreatmentarea{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Comments != nil { + m.Comments = o.Comments() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Notified != nil { + m.Notified = o.Notified() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.SessionID != nil { + m.SessionID = o.SessionID() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.Treatdate != nil { + m.Treatdate = o.Treatdate() + } + if o.TreatID != nil { + m.TreatID = o.TreatID() + } + if o.Type != nil { + m.Type = o.Type() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryTreatmentareaSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryTreatmentareaTemplate.CreateMany +func (o HistoryTreatmentareaTemplate) BuildMany(number int) models.HistoryTreatmentareaSlice { + m := make(models.HistoryTreatmentareaSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryTreatmentarea(m *models.HistoryTreatmentareaSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryTreatmentarea +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyTreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTreatmentarea, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryTreatmentarea(opt) + + m, err := models.HistoryTreatmentareas.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyTreatmentarea and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryTreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTreatmentarea { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyTreatmentarea 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 *HistoryTreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTreatmentarea { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyTreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryTreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTreatmentareaSlice, error) { + var err error + m := make(models.HistoryTreatmentareaSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyTreatmentareas and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryTreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTreatmentareaSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyTreatmentareas 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 HistoryTreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTreatmentareaSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryTreatmentarea has methods that act as mods for the HistoryTreatmentareaTemplate +var HistoryTreatmentareaMods historyTreatmentareaMods + +type historyTreatmentareaMods struct{} + +func (m historyTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModSlice{ + HistoryTreatmentareaMods.RandomOrganizationID(f), + HistoryTreatmentareaMods.RandomComments(f), + HistoryTreatmentareaMods.RandomCreationdate(f), + HistoryTreatmentareaMods.RandomCreator(f), + HistoryTreatmentareaMods.RandomEditdate(f), + HistoryTreatmentareaMods.RandomEditor(f), + HistoryTreatmentareaMods.RandomGlobalid(f), + HistoryTreatmentareaMods.RandomNotified(f), + HistoryTreatmentareaMods.RandomObjectid(f), + HistoryTreatmentareaMods.RandomSessionID(f), + HistoryTreatmentareaMods.RandomShapeArea(f), + HistoryTreatmentareaMods.RandomShapeLength(f), + HistoryTreatmentareaMods.RandomTreatdate(f), + HistoryTreatmentareaMods.RandomTreatID(f), + HistoryTreatmentareaMods.RandomType(f), + HistoryTreatmentareaMods.RandomCreatedDate(f), + HistoryTreatmentareaMods.RandomCreatedUser(f), + HistoryTreatmentareaMods.RandomGeometryX(f), + HistoryTreatmentareaMods.RandomGeometryY(f), + HistoryTreatmentareaMods.RandomLastEditedDate(f), + HistoryTreatmentareaMods.RandomLastEditedUser(f), + HistoryTreatmentareaMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) OrganizationID(val null.Val[int32]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetOrganizationID() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Comments(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CommentsFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Comments = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetComments() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Comments = 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) RandomComments(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCommentsNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Comments = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Creationdate(val null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetCreationdate() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Creator(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CreatorFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetCreator() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Editdate(val null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) EditdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetEditdate() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Editor(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) EditorFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetEditor() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Globalid(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) GlobalidFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetGlobalid() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Notified(val null.Val[int16]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) NotifiedFunc(f func() null.Val[int16]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Notified = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetNotified() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Notified = 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) RandomNotified(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Notified = func() null.Val[int16] { + if f == nil { + f = &defaultFaker + } + + val := random_int16(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Objectid(val int32) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) ObjectidFunc(f func() int32) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetObjectid() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTreatmentareaMods) RandomObjectid(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) SessionID(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) SessionIDFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.SessionID = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetSessionID() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.SessionID = 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) RandomSessionID(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomSessionIDNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.SessionID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) ShapeArea(val null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetShapeArea() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeArea = 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) RandomShapeArea(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) ShapeLength(val null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetShapeLength() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeLength = 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) RandomShapeLength(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Treatdate(val null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) TreatdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Treatdate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetTreatdate() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Treatdate = 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) RandomTreatdate(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomTreatdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Treatdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) TreatID(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) TreatIDFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.TreatID = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetTreatID() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.TreatID = 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) RandomTreatID(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTreatIDNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.TreatID = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Type(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Type = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) TypeFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetType() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Type = 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) RandomType(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomTypeNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Type = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetCreatedDate() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) CreatedUser(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CreatedUserFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetCreatedUser() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) GeometryX(val null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetGeometryX() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) GeometryY(val null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetGeometryY() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) LastEditedDate(val null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetLastEditedDate() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) LastEditedUser(val null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetLastEditedUser() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyTreatmentareaMods) Version(val int32) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) VersionFunc(f func() int32) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetVersion() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyTreatmentareaMods) RandomVersion(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyTreatmentareaMods) WithParentsCascading() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { + if isDone, _ := historyTreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyTreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyTreatmentareaMods) WithOrganization(rel *OrganizationTemplate) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { + o.r.Organization = &historyTreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m historyTreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyTreatmentareaMods) WithExistingOrganization(em *models.Organization) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { + o.r.Organization = &historyTreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyTreatmentareaMods) WithoutOrganization() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_zones.bob.go b/factory/history_zones.bob.go new file mode 100644 index 00000000..5db559ca --- /dev/null +++ b/factory/history_zones.bob.go @@ -0,0 +1,1363 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryZoneMod interface { + Apply(context.Context, *HistoryZoneTemplate) +} + +type HistoryZoneModFunc func(context.Context, *HistoryZoneTemplate) + +func (f HistoryZoneModFunc) Apply(ctx context.Context, n *HistoryZoneTemplate) { + f(ctx, n) +} + +type HistoryZoneModSlice []HistoryZoneMod + +func (mods HistoryZoneModSlice) Apply(ctx context.Context, n *HistoryZoneTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Active func() null.Val[int64] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyZoneR + f *Factory + + alreadyPersisted bool +} + +type historyZoneR struct { + Organization *historyZoneROrganizationR +} + +type historyZoneROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryZoneTemplate +func (o *HistoryZoneTemplate) Apply(ctx context.Context, mods ...HistoryZoneMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryZone +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryZoneSetter +// this does nothing with the relationship templates +func (o HistoryZoneTemplate) BuildSetter() *models.HistoryZoneSetter { + m := &models.HistoryZoneSetter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Active != nil { + val := o.Active() + m.Active = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryZoneSetter +// this does nothing with the relationship templates +func (o HistoryZoneTemplate) BuildManySetter(number int) []*models.HistoryZoneSetter { + m := make([]*models.HistoryZoneSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryZone +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.Create +func (o HistoryZoneTemplate) Build() *models.HistoryZone { + m := &models.HistoryZone{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Active != nil { + m.Active = o.Active() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryZoneSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.CreateMany +func (o HistoryZoneTemplate) BuildMany(number int) models.HistoryZoneSlice { + m := make(models.HistoryZoneSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryZone(m *models.HistoryZoneSetter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryZone +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyZone and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryZone, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryZone(opt) + + m, err := models.HistoryZones.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyZone and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryZone { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyZone 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 *HistoryZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryZone { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyZones and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryZoneSlice, error) { + var err error + m := make(models.HistoryZoneSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyZones and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryZoneSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyZones 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 HistoryZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryZoneSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryZone has methods that act as mods for the HistoryZoneTemplate +var HistoryZoneMods historyZoneMods + +type historyZoneMods struct{} + +func (m historyZoneMods) RandomizeAllColumns(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModSlice{ + HistoryZoneMods.RandomOrganizationID(f), + HistoryZoneMods.RandomActive(f), + HistoryZoneMods.RandomCreationdate(f), + HistoryZoneMods.RandomCreator(f), + HistoryZoneMods.RandomEditdate(f), + HistoryZoneMods.RandomEditor(f), + HistoryZoneMods.RandomGlobalid(f), + HistoryZoneMods.RandomName(f), + HistoryZoneMods.RandomObjectid(f), + HistoryZoneMods.RandomShapeArea(f), + HistoryZoneMods.RandomShapeLength(f), + HistoryZoneMods.RandomCreatedDate(f), + HistoryZoneMods.RandomCreatedUser(f), + HistoryZoneMods.RandomGeometryX(f), + HistoryZoneMods.RandomGeometryY(f), + HistoryZoneMods.RandomLastEditedDate(f), + HistoryZoneMods.RandomLastEditedUser(f), + HistoryZoneMods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyZoneMods) OrganizationID(val null.Val[int32]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetOrganizationID() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Active(val null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Active = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) ActiveFunc(f func() null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Active = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetActive() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Active = 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) RandomActive(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Active = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomActiveNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Active = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Creationdate(val null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) CreationdateFunc(f func() null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetCreationdate() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Creator(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) CreatorFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetCreator() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Editdate(val null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) EditdateFunc(f func() null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetEditdate() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Editor(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) EditorFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetEditor() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Globalid(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) GlobalidFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetGlobalid() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Name(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) NameFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetName() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Name = 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) RandomName(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Objectid(val int32) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) ObjectidFunc(f func() int32) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetObjectid() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyZoneMods) RandomObjectid(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) ShapeArea(val null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetShapeArea() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeArea = 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) RandomShapeArea(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) ShapeLength(val null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetShapeLength() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeLength = 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) RandomShapeLength(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) CreatedDateFunc(f func() null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetCreatedDate() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) CreatedUser(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) CreatedUserFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetCreatedUser() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) GeometryX(val null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) GeometryXFunc(f func() null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetGeometryX() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) GeometryY(val null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) GeometryYFunc(f func() null.Val[float64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetGeometryY() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) LastEditedDate(val null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetLastEditedDate() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) LastEditedUser(val null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) LastEditedUserFunc(f func() null.Val[string]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetLastEditedUser() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZoneMods) Version(val int32) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) VersionFunc(f func() int32) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetVersion() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyZoneMods) RandomVersion(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyZoneMods) WithParentsCascading() HistoryZoneMod { + return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { + if isDone, _ := historyZoneWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyZoneWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyZoneMods) WithOrganization(rel *OrganizationTemplate) HistoryZoneMod { + return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { + o.r.Organization = &historyZoneROrganizationR{ + o: rel, + } + }) +} + +func (m historyZoneMods) WithNewOrganization(mods ...OrganizationMod) HistoryZoneMod { + return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyZoneMods) WithExistingOrganization(em *models.Organization) HistoryZoneMod { + return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { + o.r.Organization = &historyZoneROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyZoneMods) WithoutOrganization() HistoryZoneMod { + return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/history_zones2.bob.go b/factory/history_zones2.bob.go new file mode 100644 index 00000000..20edabe3 --- /dev/null +++ b/factory/history_zones2.bob.go @@ -0,0 +1,1301 @@ +// 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" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type HistoryZones2Mod interface { + Apply(context.Context, *HistoryZones2Template) +} + +type HistoryZones2ModFunc func(context.Context, *HistoryZones2Template) + +func (f HistoryZones2ModFunc) Apply(ctx context.Context, n *HistoryZones2Template) { + f(ctx, n) +} + +type HistoryZones2ModSlice []HistoryZones2Mod + +func (mods HistoryZones2ModSlice) Apply(ctx context.Context, n *HistoryZones2Template) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// 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] + Creationdate func() null.Val[int64] + Creator func() null.Val[string] + Editdate func() null.Val[int64] + Editor func() null.Val[string] + Globalid func() null.Val[string] + Name func() null.Val[string] + Objectid func() int32 + ShapeArea func() null.Val[float64] + ShapeLength func() null.Val[float64] + CreatedDate func() null.Val[int64] + CreatedUser func() null.Val[string] + GeometryX func() null.Val[float64] + GeometryY func() null.Val[float64] + LastEditedDate func() null.Val[int64] + LastEditedUser func() null.Val[string] + Version func() int32 + + r historyZones2R + f *Factory + + alreadyPersisted bool +} + +type historyZones2R struct { + Organization *historyZones2ROrganizationR +} + +type historyZones2ROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the HistoryZones2Template +func (o *HistoryZones2Template) Apply(ctx context.Context, mods ...HistoryZones2Mod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.HistoryZones2 +// according to the relationships in the template. Nothing is inserted into the db +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.R.Organization = rel + } +} + +// BuildSetter returns an *models.HistoryZones2Setter +// this does nothing with the relationship templates +func (o HistoryZones2Template) BuildSetter() *models.HistoryZones2Setter { + m := &models.HistoryZones2Setter{} + + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omitnull.FromNull(val) + } + if o.Creationdate != nil { + val := o.Creationdate() + m.Creationdate = omitnull.FromNull(val) + } + if o.Creator != nil { + val := o.Creator() + m.Creator = omitnull.FromNull(val) + } + if o.Editdate != nil { + val := o.Editdate() + m.Editdate = omitnull.FromNull(val) + } + if o.Editor != nil { + val := o.Editor() + m.Editor = omitnull.FromNull(val) + } + if o.Globalid != nil { + val := o.Globalid() + m.Globalid = omitnull.FromNull(val) + } + if o.Name != nil { + val := o.Name() + m.Name = omitnull.FromNull(val) + } + if o.Objectid != nil { + val := o.Objectid() + m.Objectid = omit.From(val) + } + if o.ShapeArea != nil { + val := o.ShapeArea() + m.ShapeArea = omitnull.FromNull(val) + } + if o.ShapeLength != nil { + val := o.ShapeLength() + m.ShapeLength = omitnull.FromNull(val) + } + if o.CreatedDate != nil { + val := o.CreatedDate() + m.CreatedDate = omitnull.FromNull(val) + } + if o.CreatedUser != nil { + val := o.CreatedUser() + m.CreatedUser = omitnull.FromNull(val) + } + if o.GeometryX != nil { + val := o.GeometryX() + m.GeometryX = omitnull.FromNull(val) + } + if o.GeometryY != nil { + val := o.GeometryY() + m.GeometryY = omitnull.FromNull(val) + } + if o.LastEditedDate != nil { + val := o.LastEditedDate() + m.LastEditedDate = omitnull.FromNull(val) + } + if o.LastEditedUser != nil { + val := o.LastEditedUser() + m.LastEditedUser = omitnull.FromNull(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.HistoryZones2Setter +// this does nothing with the relationship templates +func (o HistoryZones2Template) BuildManySetter(number int) []*models.HistoryZones2Setter { + m := make([]*models.HistoryZones2Setter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.HistoryZones2 +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryZones2Template.Create +func (o HistoryZones2Template) Build() *models.HistoryZones2 { + m := &models.HistoryZones2{} + + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Creationdate != nil { + m.Creationdate = o.Creationdate() + } + if o.Creator != nil { + m.Creator = o.Creator() + } + if o.Editdate != nil { + m.Editdate = o.Editdate() + } + if o.Editor != nil { + m.Editor = o.Editor() + } + if o.Globalid != nil { + m.Globalid = o.Globalid() + } + if o.Name != nil { + m.Name = o.Name() + } + if o.Objectid != nil { + m.Objectid = o.Objectid() + } + if o.ShapeArea != nil { + m.ShapeArea = o.ShapeArea() + } + if o.ShapeLength != nil { + m.ShapeLength = o.ShapeLength() + } + if o.CreatedDate != nil { + m.CreatedDate = o.CreatedDate() + } + if o.CreatedUser != nil { + m.CreatedUser = o.CreatedUser() + } + if o.GeometryX != nil { + m.GeometryX = o.GeometryX() + } + if o.GeometryY != nil { + m.GeometryY = o.GeometryY() + } + if o.LastEditedDate != nil { + m.LastEditedDate = o.LastEditedDate() + } + if o.LastEditedUser != nil { + m.LastEditedUser = o.LastEditedUser() + } + if o.Version != nil { + m.Version = o.Version() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.HistoryZones2Slice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use HistoryZones2Template.CreateMany +func (o HistoryZones2Template) BuildMany(number int) models.HistoryZones2Slice { + m := make(models.HistoryZones2Slice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableHistoryZones2(m *models.HistoryZones2Setter) { + if !(m.Objectid.IsValue()) { + val := random_int32(nil) + m.Objectid = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.HistoryZones2 +// according to the relationships in the template. +// any required relationship should have already exist on the model +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 +} + +// Create builds a historyZones2 and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *HistoryZones2Template) Create(ctx context.Context, exec bob.Executor) (*models.HistoryZones2, error) { + var err error + opt := o.BuildSetter() + ensureCreatableHistoryZones2(opt) + + m, err := models.HistoryZones2s.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a historyZones2 and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *HistoryZones2Template) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryZones2 { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a historyZones2 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 *HistoryZones2Template) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryZones2 { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple historyZones2s and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o HistoryZones2Template) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryZones2Slice, error) { + var err error + m := make(models.HistoryZones2Slice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple historyZones2s and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o HistoryZones2Template) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryZones2Slice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple historyZones2s 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 HistoryZones2Template) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryZones2Slice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// HistoryZones2 has methods that act as mods for the HistoryZones2Template +var HistoryZones2Mods historyZones2Mods + +type historyZones2Mods struct{} + +func (m historyZones2Mods) RandomizeAllColumns(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModSlice{ + HistoryZones2Mods.RandomOrganizationID(f), + HistoryZones2Mods.RandomCreationdate(f), + HistoryZones2Mods.RandomCreator(f), + HistoryZones2Mods.RandomEditdate(f), + HistoryZones2Mods.RandomEditor(f), + HistoryZones2Mods.RandomGlobalid(f), + HistoryZones2Mods.RandomName(f), + HistoryZones2Mods.RandomObjectid(f), + HistoryZones2Mods.RandomShapeArea(f), + HistoryZones2Mods.RandomShapeLength(f), + HistoryZones2Mods.RandomCreatedDate(f), + HistoryZones2Mods.RandomCreatedUser(f), + HistoryZones2Mods.RandomGeometryX(f), + HistoryZones2Mods.RandomGeometryY(f), + HistoryZones2Mods.RandomLastEditedDate(f), + HistoryZones2Mods.RandomLastEditedUser(f), + HistoryZones2Mods.RandomVersion(f), + } +} + +// Set the model columns to this value +func (m historyZones2Mods) OrganizationID(val null.Val[int32]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.OrganizationID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) OrganizationIDFunc(f func() null.Val[int32]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetOrganizationID() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.OrganizationID = 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) 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) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Creationdate(val null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creationdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) CreationdateFunc(f func() null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creationdate = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetCreationdate() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creationdate = 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) RandomCreationdate(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creationdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Creator(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creator = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) CreatorFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creator = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetCreator() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creator = 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) RandomCreator(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatorNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Creator = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Editdate(val null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editdate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) EditdateFunc(f func() null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editdate = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetEditdate() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editdate = 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) RandomEditdate(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editdate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Editor(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editor = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) EditorFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editor = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetEditor() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editor = 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) RandomEditor(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomEditorNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Editor = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Globalid(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Globalid = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) GlobalidFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Globalid = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetGlobalid() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Globalid = 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) RandomGlobalid(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomGlobalidNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Globalid = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Name(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Name = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) NameFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Name = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetName() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Name = 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) RandomName(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomNameNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Name = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Objectid(val int32) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Objectid = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) ObjectidFunc(f func() int32) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Objectid = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetObjectid() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Objectid = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyZones2Mods) RandomObjectid(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Objectid = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) ShapeArea(val null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeArea = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) ShapeAreaFunc(f func() null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeArea = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetShapeArea() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeArea = 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) RandomShapeArea(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeAreaNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeArea = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) ShapeLength(val null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeLength = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) ShapeLengthFunc(f func() null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeLength = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetShapeLength() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeLength = 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) RandomShapeLength(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomShapeLengthNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.ShapeLength = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) { + o.CreatedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) CreatedDateFunc(f func() null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedDate = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetCreatedDate() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedDate = 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) RandomCreatedDate(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) CreatedUser(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) CreatedUserFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedUser = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetCreatedUser() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedUser = 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) RandomCreatedUser(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomCreatedUserNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.CreatedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) GeometryX(val null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) GeometryXFunc(f func() null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryX = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetGeometryX() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryX = 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) RandomGeometryX(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryXNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) GeometryY(val null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) GeometryYFunc(f func() null.Val[float64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryY = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetGeometryY() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryY = 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) RandomGeometryY(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(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) RandomGeometryYNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.GeometryY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) LastEditedDate(val null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedDate = func() null.Val[int64] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) LastEditedDateFunc(f func() null.Val[int64]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedDate = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetLastEditedDate() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedDate = 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) RandomLastEditedDate(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedDate = func() null.Val[int64] { + if f == nil { + f = &defaultFaker + } + + val := random_int64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) LastEditedUser(val null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedUser = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) LastEditedUserFunc(f func() null.Val[string]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedUser = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetLastEditedUser() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedUser = 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) RandomLastEditedUser(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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) RandomLastEditedUserNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.LastEditedUser = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m historyZones2Mods) Version(val int32) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) VersionFunc(f func() int32) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Version = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetVersion() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m historyZones2Mods) RandomVersion(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +func (m historyZones2Mods) WithParentsCascading() HistoryZones2Mod { + return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { + if isDone, _ := historyZones2WithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = historyZones2WithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m historyZones2Mods) WithOrganization(rel *OrganizationTemplate) HistoryZones2Mod { + return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { + o.r.Organization = &historyZones2ROrganizationR{ + o: rel, + } + }) +} + +func (m historyZones2Mods) WithNewOrganization(mods ...OrganizationMod) HistoryZones2Mod { + return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m historyZones2Mods) WithExistingOrganization(em *models.Organization) HistoryZones2Mod { + return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { + o.r.Organization = &historyZones2ROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m historyZones2Mods) WithoutOrganization() HistoryZones2Mod { + return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { + o.r.Organization = nil + }) +} diff --git a/factory/organization.bob.go b/factory/organization.bob.go index b63e41f6..d64dc35c 100644 --- a/factory/organization.bob.go +++ b/factory/organization.bob.go @@ -36,10 +36,11 @@ func (mods OrganizationModSlice) Apply(ctx context.Context, n *OrganizationTempl // OrganizationTemplate is an object representing the database table. // all columns are optional and should be set by mods type OrganizationTemplate struct { - ID func() int32 - Name func() null.Val[string] - ArcgisID func() null.Val[string] - ArcgisName func() null.Val[string] + ID func() int32 + Name func() null.Val[string] + ArcgisID func() null.Val[string] + ArcgisName func() null.Val[string] + FieldseekerURL func() null.Val[string] r organizationR f *Factory @@ -48,9 +49,279 @@ type OrganizationTemplate struct { } type organizationR struct { - User []*organizationRUserR + FSContainerrelates []*organizationRFSContainerrelatesR + FSFieldscoutinglogs []*organizationRFSFieldscoutinglogsR + FSHabitatrelates []*organizationRFSHabitatrelatesR + FSInspectionsamples []*organizationRFSInspectionsamplesR + FSInspectionsampledetails []*organizationRFSInspectionsampledetailsR + FSLinelocations []*organizationRFSLinelocationsR + FSLocationtrackings []*organizationRFSLocationtrackingsR + FSMosquitoinspections []*organizationRFSMosquitoinspectionsR + FSPointlocations []*organizationRFSPointlocationsR + FSPolygonlocations []*organizationRFSPolygonlocationsR + FSPools []*organizationRFSPoolsR + FSPooldetails []*organizationRFSPooldetailsR + FSProposedtreatmentareas []*organizationRFSProposedtreatmentareasR + FSQamosquitoinspections []*organizationRFSQamosquitoinspectionsR + FSRodentlocations []*organizationRFSRodentlocationsR + FSSamplecollections []*organizationRFSSamplecollectionsR + FSSamplelocations []*organizationRFSSamplelocationsR + FSServicerequests []*organizationRFSServicerequestsR + FSSpeciesabundances []*organizationRFSSpeciesabundancesR + FSStormdrains []*organizationRFSStormdrainsR + FSTimecards []*organizationRFSTimecardsR + FSTrapdata []*organizationRFSTrapdataR + FSTraplocations []*organizationRFSTraplocationsR + FSTreatments []*organizationRFSTreatmentsR + FSTreatmentareas []*organizationRFSTreatmentareasR + FSZones []*organizationRFSZonesR + FSZones2s []*organizationRFSZones2sR + HistoryContainerrelates []*organizationRHistoryContainerrelatesR + HistoryFieldscoutinglogs []*organizationRHistoryFieldscoutinglogsR + HistoryHabitatrelates []*organizationRHistoryHabitatrelatesR + HistoryInspectionsamples []*organizationRHistoryInspectionsamplesR + HistoryInspectionsampledetails []*organizationRHistoryInspectionsampledetailsR + HistoryLinelocations []*organizationRHistoryLinelocationsR + HistoryLocationtrackings []*organizationRHistoryLocationtrackingsR + HistoryMosquitoinspections []*organizationRHistoryMosquitoinspectionsR + HistoryPointlocations []*organizationRHistoryPointlocationsR + HistoryPolygonlocations []*organizationRHistoryPolygonlocationsR + HistoryPools []*organizationRHistoryPoolsR + HistoryPooldetails []*organizationRHistoryPooldetailsR + HistoryProposedtreatmentareas []*organizationRHistoryProposedtreatmentareasR + HistoryQamosquitoinspections []*organizationRHistoryQamosquitoinspectionsR + HistoryRodentlocations []*organizationRHistoryRodentlocationsR + HistorySamplecollections []*organizationRHistorySamplecollectionsR + HistorySamplelocations []*organizationRHistorySamplelocationsR + HistoryServicerequests []*organizationRHistoryServicerequestsR + HistorySpeciesabundances []*organizationRHistorySpeciesabundancesR + HistoryStormdrains []*organizationRHistoryStormdrainsR + HistoryTimecards []*organizationRHistoryTimecardsR + HistoryTrapdata []*organizationRHistoryTrapdataR + HistoryTraplocations []*organizationRHistoryTraplocationsR + HistoryTreatments []*organizationRHistoryTreatmentsR + HistoryTreatmentareas []*organizationRHistoryTreatmentareasR + HistoryZones []*organizationRHistoryZonesR + HistoryZones2s []*organizationRHistoryZones2sR + User []*organizationRUserR } +type organizationRFSContainerrelatesR struct { + number int + o *FSContainerrelateTemplate +} +type organizationRFSFieldscoutinglogsR struct { + number int + o *FSFieldscoutinglogTemplate +} +type organizationRFSHabitatrelatesR struct { + number int + o *FSHabitatrelateTemplate +} +type organizationRFSInspectionsamplesR struct { + number int + o *FSInspectionsampleTemplate +} +type organizationRFSInspectionsampledetailsR struct { + number int + o *FSInspectionsampledetailTemplate +} +type organizationRFSLinelocationsR struct { + number int + o *FSLinelocationTemplate +} +type organizationRFSLocationtrackingsR struct { + number int + o *FSLocationtrackingTemplate +} +type organizationRFSMosquitoinspectionsR struct { + number int + o *FSMosquitoinspectionTemplate +} +type organizationRFSPointlocationsR struct { + number int + o *FSPointlocationTemplate +} +type organizationRFSPolygonlocationsR struct { + number int + o *FSPolygonlocationTemplate +} +type organizationRFSPoolsR struct { + number int + o *FSPoolTemplate +} +type organizationRFSPooldetailsR struct { + number int + o *FSPooldetailTemplate +} +type organizationRFSProposedtreatmentareasR struct { + number int + o *FSProposedtreatmentareaTemplate +} +type organizationRFSQamosquitoinspectionsR struct { + number int + o *FSQamosquitoinspectionTemplate +} +type organizationRFSRodentlocationsR struct { + number int + o *FSRodentlocationTemplate +} +type organizationRFSSamplecollectionsR struct { + number int + o *FSSamplecollectionTemplate +} +type organizationRFSSamplelocationsR struct { + number int + o *FSSamplelocationTemplate +} +type organizationRFSServicerequestsR struct { + number int + o *FSServicerequestTemplate +} +type organizationRFSSpeciesabundancesR struct { + number int + o *FSSpeciesabundanceTemplate +} +type organizationRFSStormdrainsR struct { + number int + o *FSStormdrainTemplate +} +type organizationRFSTimecardsR struct { + number int + o *FSTimecardTemplate +} +type organizationRFSTrapdataR struct { + number int + o *FSTrapdatumTemplate +} +type organizationRFSTraplocationsR struct { + number int + o *FSTraplocationTemplate +} +type organizationRFSTreatmentsR struct { + number int + o *FSTreatmentTemplate +} +type organizationRFSTreatmentareasR struct { + number int + o *FSTreatmentareaTemplate +} +type organizationRFSZonesR struct { + number int + o *FSZoneTemplate +} +type organizationRFSZones2sR struct { + number int + o *FSZones2Template +} +type organizationRHistoryContainerrelatesR struct { + number int + o *HistoryContainerrelateTemplate +} +type organizationRHistoryFieldscoutinglogsR struct { + number int + o *HistoryFieldscoutinglogTemplate +} +type organizationRHistoryHabitatrelatesR struct { + number int + o *HistoryHabitatrelateTemplate +} +type organizationRHistoryInspectionsamplesR struct { + number int + o *HistoryInspectionsampleTemplate +} +type organizationRHistoryInspectionsampledetailsR struct { + number int + o *HistoryInspectionsampledetailTemplate +} +type organizationRHistoryLinelocationsR struct { + number int + o *HistoryLinelocationTemplate +} +type organizationRHistoryLocationtrackingsR struct { + number int + o *HistoryLocationtrackingTemplate +} +type organizationRHistoryMosquitoinspectionsR struct { + number int + o *HistoryMosquitoinspectionTemplate +} +type organizationRHistoryPointlocationsR struct { + number int + o *HistoryPointlocationTemplate +} +type organizationRHistoryPolygonlocationsR struct { + number int + o *HistoryPolygonlocationTemplate +} +type organizationRHistoryPoolsR struct { + number int + o *HistoryPoolTemplate +} +type organizationRHistoryPooldetailsR struct { + number int + o *HistoryPooldetailTemplate +} +type organizationRHistoryProposedtreatmentareasR struct { + number int + o *HistoryProposedtreatmentareaTemplate +} +type organizationRHistoryQamosquitoinspectionsR struct { + number int + o *HistoryQamosquitoinspectionTemplate +} +type organizationRHistoryRodentlocationsR struct { + number int + o *HistoryRodentlocationTemplate +} +type organizationRHistorySamplecollectionsR struct { + number int + o *HistorySamplecollectionTemplate +} +type organizationRHistorySamplelocationsR struct { + number int + o *HistorySamplelocationTemplate +} +type organizationRHistoryServicerequestsR struct { + number int + o *HistoryServicerequestTemplate +} +type organizationRHistorySpeciesabundancesR struct { + number int + o *HistorySpeciesabundanceTemplate +} +type organizationRHistoryStormdrainsR struct { + number int + o *HistoryStormdrainTemplate +} +type organizationRHistoryTimecardsR struct { + number int + o *HistoryTimecardTemplate +} +type organizationRHistoryTrapdataR struct { + number int + o *HistoryTrapdatumTemplate +} +type organizationRHistoryTraplocationsR struct { + number int + o *HistoryTraplocationTemplate +} +type organizationRHistoryTreatmentsR struct { + number int + o *HistoryTreatmentTemplate +} +type organizationRHistoryTreatmentareasR struct { + number int + o *HistoryTreatmentareaTemplate +} +type organizationRHistoryZonesR struct { + number int + o *HistoryZoneTemplate +} +type organizationRHistoryZones2sR struct { + number int + o *HistoryZones2Template +} type organizationRUserR struct { number int o *UserTemplate @@ -66,6 +337,708 @@ 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.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.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSContainerrelates = rel + } + + if t.r.FSFieldscoutinglogs != nil { + rel := models.FSFieldscoutinglogSlice{} + for _, r := range t.r.FSFieldscoutinglogs { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSFieldscoutinglogs = rel + } + + if t.r.FSHabitatrelates != nil { + rel := models.FSHabitatrelateSlice{} + for _, r := range t.r.FSHabitatrelates { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSHabitatrelates = rel + } + + if t.r.FSInspectionsamples != nil { + rel := models.FSInspectionsampleSlice{} + for _, r := range t.r.FSInspectionsamples { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSInspectionsamples = rel + } + + if t.r.FSInspectionsampledetails != nil { + rel := models.FSInspectionsampledetailSlice{} + for _, r := range t.r.FSInspectionsampledetails { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSInspectionsampledetails = rel + } + + if t.r.FSLinelocations != nil { + rel := models.FSLinelocationSlice{} + for _, r := range t.r.FSLinelocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSLinelocations = rel + } + + if t.r.FSLocationtrackings != nil { + rel := models.FSLocationtrackingSlice{} + for _, r := range t.r.FSLocationtrackings { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSLocationtrackings = rel + } + + if t.r.FSMosquitoinspections != nil { + rel := models.FSMosquitoinspectionSlice{} + for _, r := range t.r.FSMosquitoinspections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSMosquitoinspections = rel + } + + if t.r.FSPointlocations != nil { + rel := models.FSPointlocationSlice{} + for _, r := range t.r.FSPointlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSPointlocations = rel + } + + if t.r.FSPolygonlocations != nil { + rel := models.FSPolygonlocationSlice{} + for _, r := range t.r.FSPolygonlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSPolygonlocations = rel + } + + if t.r.FSPools != nil { + rel := models.FSPoolSlice{} + for _, r := range t.r.FSPools { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSPools = rel + } + + if t.r.FSPooldetails != nil { + rel := models.FSPooldetailSlice{} + for _, r := range t.r.FSPooldetails { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSPooldetails = rel + } + + if t.r.FSProposedtreatmentareas != nil { + rel := models.FSProposedtreatmentareaSlice{} + for _, r := range t.r.FSProposedtreatmentareas { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSProposedtreatmentareas = rel + } + + if t.r.FSQamosquitoinspections != nil { + rel := models.FSQamosquitoinspectionSlice{} + for _, r := range t.r.FSQamosquitoinspections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSQamosquitoinspections = rel + } + + if t.r.FSRodentlocations != nil { + rel := models.FSRodentlocationSlice{} + for _, r := range t.r.FSRodentlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSRodentlocations = rel + } + + if t.r.FSSamplecollections != nil { + rel := models.FSSamplecollectionSlice{} + for _, r := range t.r.FSSamplecollections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSSamplecollections = rel + } + + if t.r.FSSamplelocations != nil { + rel := models.FSSamplelocationSlice{} + for _, r := range t.r.FSSamplelocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSSamplelocations = rel + } + + if t.r.FSServicerequests != nil { + rel := models.FSServicerequestSlice{} + for _, r := range t.r.FSServicerequests { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSServicerequests = rel + } + + if t.r.FSSpeciesabundances != nil { + rel := models.FSSpeciesabundanceSlice{} + for _, r := range t.r.FSSpeciesabundances { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSSpeciesabundances = rel + } + + if t.r.FSStormdrains != nil { + rel := models.FSStormdrainSlice{} + for _, r := range t.r.FSStormdrains { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSStormdrains = rel + } + + if t.r.FSTimecards != nil { + rel := models.FSTimecardSlice{} + for _, r := range t.r.FSTimecards { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSTimecards = rel + } + + if t.r.FSTrapdata != nil { + rel := models.FSTrapdatumSlice{} + for _, r := range t.r.FSTrapdata { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSTrapdata = rel + } + + if t.r.FSTraplocations != nil { + rel := models.FSTraplocationSlice{} + for _, r := range t.r.FSTraplocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSTraplocations = rel + } + + if t.r.FSTreatments != nil { + rel := models.FSTreatmentSlice{} + for _, r := range t.r.FSTreatments { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSTreatments = rel + } + + if t.r.FSTreatmentareas != nil { + rel := models.FSTreatmentareaSlice{} + for _, r := range t.r.FSTreatmentareas { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSTreatmentareas = rel + } + + if t.r.FSZones != nil { + rel := models.FSZoneSlice{} + for _, r := range t.r.FSZones { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSZones = rel + } + + if t.r.FSZones2s != nil { + rel := models.FSZones2Slice{} + for _, r := range t.r.FSZones2s { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FSZones2s = rel + } + + if t.r.HistoryContainerrelates != nil { + rel := models.HistoryContainerrelateSlice{} + for _, r := range t.r.HistoryContainerrelates { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryContainerrelates = rel + } + + if t.r.HistoryFieldscoutinglogs != nil { + rel := models.HistoryFieldscoutinglogSlice{} + for _, r := range t.r.HistoryFieldscoutinglogs { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryFieldscoutinglogs = rel + } + + if t.r.HistoryHabitatrelates != nil { + rel := models.HistoryHabitatrelateSlice{} + for _, r := range t.r.HistoryHabitatrelates { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryHabitatrelates = rel + } + + if t.r.HistoryInspectionsamples != nil { + rel := models.HistoryInspectionsampleSlice{} + for _, r := range t.r.HistoryInspectionsamples { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryInspectionsamples = rel + } + + if t.r.HistoryInspectionsampledetails != nil { + rel := models.HistoryInspectionsampledetailSlice{} + for _, r := range t.r.HistoryInspectionsampledetails { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryInspectionsampledetails = rel + } + + if t.r.HistoryLinelocations != nil { + rel := models.HistoryLinelocationSlice{} + for _, r := range t.r.HistoryLinelocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryLinelocations = rel + } + + if t.r.HistoryLocationtrackings != nil { + rel := models.HistoryLocationtrackingSlice{} + for _, r := range t.r.HistoryLocationtrackings { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryLocationtrackings = rel + } + + if t.r.HistoryMosquitoinspections != nil { + rel := models.HistoryMosquitoinspectionSlice{} + for _, r := range t.r.HistoryMosquitoinspections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryMosquitoinspections = rel + } + + if t.r.HistoryPointlocations != nil { + rel := models.HistoryPointlocationSlice{} + for _, r := range t.r.HistoryPointlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryPointlocations = rel + } + + if t.r.HistoryPolygonlocations != nil { + rel := models.HistoryPolygonlocationSlice{} + for _, r := range t.r.HistoryPolygonlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryPolygonlocations = rel + } + + if t.r.HistoryPools != nil { + rel := models.HistoryPoolSlice{} + for _, r := range t.r.HistoryPools { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryPools = rel + } + + if t.r.HistoryPooldetails != nil { + rel := models.HistoryPooldetailSlice{} + for _, r := range t.r.HistoryPooldetails { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryPooldetails = rel + } + + if t.r.HistoryProposedtreatmentareas != nil { + rel := models.HistoryProposedtreatmentareaSlice{} + for _, r := range t.r.HistoryProposedtreatmentareas { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryProposedtreatmentareas = rel + } + + if t.r.HistoryQamosquitoinspections != nil { + rel := models.HistoryQamosquitoinspectionSlice{} + for _, r := range t.r.HistoryQamosquitoinspections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryQamosquitoinspections = rel + } + + if t.r.HistoryRodentlocations != nil { + rel := models.HistoryRodentlocationSlice{} + for _, r := range t.r.HistoryRodentlocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryRodentlocations = rel + } + + if t.r.HistorySamplecollections != nil { + rel := models.HistorySamplecollectionSlice{} + for _, r := range t.r.HistorySamplecollections { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistorySamplecollections = rel + } + + if t.r.HistorySamplelocations != nil { + rel := models.HistorySamplelocationSlice{} + for _, r := range t.r.HistorySamplelocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistorySamplelocations = rel + } + + if t.r.HistoryServicerequests != nil { + rel := models.HistoryServicerequestSlice{} + for _, r := range t.r.HistoryServicerequests { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryServicerequests = rel + } + + if t.r.HistorySpeciesabundances != nil { + rel := models.HistorySpeciesabundanceSlice{} + for _, r := range t.r.HistorySpeciesabundances { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistorySpeciesabundances = rel + } + + if t.r.HistoryStormdrains != nil { + rel := models.HistoryStormdrainSlice{} + for _, r := range t.r.HistoryStormdrains { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryStormdrains = rel + } + + if t.r.HistoryTimecards != nil { + rel := models.HistoryTimecardSlice{} + for _, r := range t.r.HistoryTimecards { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryTimecards = rel + } + + if t.r.HistoryTrapdata != nil { + rel := models.HistoryTrapdatumSlice{} + for _, r := range t.r.HistoryTrapdata { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryTrapdata = rel + } + + if t.r.HistoryTraplocations != nil { + rel := models.HistoryTraplocationSlice{} + for _, r := range t.r.HistoryTraplocations { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryTraplocations = rel + } + + if t.r.HistoryTreatments != nil { + rel := models.HistoryTreatmentSlice{} + for _, r := range t.r.HistoryTreatments { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryTreatments = rel + } + + if t.r.HistoryTreatmentareas != nil { + rel := models.HistoryTreatmentareaSlice{} + for _, r := range t.r.HistoryTreatmentareas { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryTreatmentareas = rel + } + + if t.r.HistoryZones != nil { + rel := models.HistoryZoneSlice{} + for _, r := range t.r.HistoryZones { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryZones = rel + } + + if t.r.HistoryZones2s != nil { + rel := models.HistoryZones2Slice{} + for _, r := range t.r.HistoryZones2s { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = null.From(o.ID) // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.HistoryZones2s = rel + } + if t.r.User != nil { rel := models.UserSlice{} for _, r := range t.r.User { @@ -101,6 +1074,10 @@ func (o OrganizationTemplate) BuildSetter() *models.OrganizationSetter { val := o.ArcgisName() m.ArcgisName = omitnull.FromNull(val) } + if o.FieldseekerURL != nil { + val := o.FieldseekerURL() + m.FieldseekerURL = omitnull.FromNull(val) + } return m } @@ -135,6 +1112,9 @@ func (o OrganizationTemplate) Build() *models.Organization { if o.ArcgisName != nil { m.ArcgisName = o.ArcgisName() } + if o.FieldseekerURL != nil { + m.FieldseekerURL = o.FieldseekerURL() + } o.setModelRels(m) @@ -163,6 +1143,1086 @@ func ensureCreatableOrganization(m *models.OrganizationSetter) { func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Organization) error { var err error + isFSContainerrelatesDone, _ := organizationRelFSContainerrelatesCtx.Value(ctx) + if !isFSContainerrelatesDone && o.r.FSContainerrelates != nil { + ctx = organizationRelFSContainerrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.FSContainerrelates { + if r.o.alreadyPersisted { + m.R.FSContainerrelates = append(m.R.FSContainerrelates, r.o.Build()) + } else { + rel0, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSContainerrelates(ctx, exec, rel0...) + if err != nil { + return err + } + } + } + } + + isFSFieldscoutinglogsDone, _ := organizationRelFSFieldscoutinglogsCtx.Value(ctx) + if !isFSFieldscoutinglogsDone && o.r.FSFieldscoutinglogs != nil { + ctx = organizationRelFSFieldscoutinglogsCtx.WithValue(ctx, true) + for _, r := range o.r.FSFieldscoutinglogs { + if r.o.alreadyPersisted { + m.R.FSFieldscoutinglogs = append(m.R.FSFieldscoutinglogs, r.o.Build()) + } else { + rel1, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSFieldscoutinglogs(ctx, exec, rel1...) + if err != nil { + return err + } + } + } + } + + isFSHabitatrelatesDone, _ := organizationRelFSHabitatrelatesCtx.Value(ctx) + if !isFSHabitatrelatesDone && o.r.FSHabitatrelates != nil { + ctx = organizationRelFSHabitatrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.FSHabitatrelates { + if r.o.alreadyPersisted { + m.R.FSHabitatrelates = append(m.R.FSHabitatrelates, r.o.Build()) + } else { + rel2, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSHabitatrelates(ctx, exec, rel2...) + if err != nil { + return err + } + } + } + } + + isFSInspectionsamplesDone, _ := organizationRelFSInspectionsamplesCtx.Value(ctx) + if !isFSInspectionsamplesDone && o.r.FSInspectionsamples != nil { + ctx = organizationRelFSInspectionsamplesCtx.WithValue(ctx, true) + for _, r := range o.r.FSInspectionsamples { + if r.o.alreadyPersisted { + m.R.FSInspectionsamples = append(m.R.FSInspectionsamples, r.o.Build()) + } else { + rel3, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSInspectionsamples(ctx, exec, rel3...) + if err != nil { + return err + } + } + } + } + + isFSInspectionsampledetailsDone, _ := organizationRelFSInspectionsampledetailsCtx.Value(ctx) + if !isFSInspectionsampledetailsDone && o.r.FSInspectionsampledetails != nil { + ctx = organizationRelFSInspectionsampledetailsCtx.WithValue(ctx, true) + for _, r := range o.r.FSInspectionsampledetails { + if r.o.alreadyPersisted { + m.R.FSInspectionsampledetails = append(m.R.FSInspectionsampledetails, r.o.Build()) + } else { + rel4, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSInspectionsampledetails(ctx, exec, rel4...) + if err != nil { + return err + } + } + } + } + + isFSLinelocationsDone, _ := organizationRelFSLinelocationsCtx.Value(ctx) + if !isFSLinelocationsDone && o.r.FSLinelocations != nil { + ctx = organizationRelFSLinelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSLinelocations { + if r.o.alreadyPersisted { + m.R.FSLinelocations = append(m.R.FSLinelocations, r.o.Build()) + } else { + rel5, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSLinelocations(ctx, exec, rel5...) + if err != nil { + return err + } + } + } + } + + isFSLocationtrackingsDone, _ := organizationRelFSLocationtrackingsCtx.Value(ctx) + if !isFSLocationtrackingsDone && o.r.FSLocationtrackings != nil { + ctx = organizationRelFSLocationtrackingsCtx.WithValue(ctx, true) + for _, r := range o.r.FSLocationtrackings { + if r.o.alreadyPersisted { + m.R.FSLocationtrackings = append(m.R.FSLocationtrackings, r.o.Build()) + } else { + rel6, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSLocationtrackings(ctx, exec, rel6...) + if err != nil { + return err + } + } + } + } + + isFSMosquitoinspectionsDone, _ := organizationRelFSMosquitoinspectionsCtx.Value(ctx) + if !isFSMosquitoinspectionsDone && o.r.FSMosquitoinspections != nil { + ctx = organizationRelFSMosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.FSMosquitoinspections { + if r.o.alreadyPersisted { + m.R.FSMosquitoinspections = append(m.R.FSMosquitoinspections, r.o.Build()) + } else { + rel7, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSMosquitoinspections(ctx, exec, rel7...) + if err != nil { + return err + } + } + } + } + + isFSPointlocationsDone, _ := organizationRelFSPointlocationsCtx.Value(ctx) + if !isFSPointlocationsDone && o.r.FSPointlocations != nil { + ctx = organizationRelFSPointlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSPointlocations { + if r.o.alreadyPersisted { + m.R.FSPointlocations = append(m.R.FSPointlocations, r.o.Build()) + } else { + rel8, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSPointlocations(ctx, exec, rel8...) + if err != nil { + return err + } + } + } + } + + isFSPolygonlocationsDone, _ := organizationRelFSPolygonlocationsCtx.Value(ctx) + if !isFSPolygonlocationsDone && o.r.FSPolygonlocations != nil { + ctx = organizationRelFSPolygonlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSPolygonlocations { + if r.o.alreadyPersisted { + m.R.FSPolygonlocations = append(m.R.FSPolygonlocations, r.o.Build()) + } else { + rel9, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSPolygonlocations(ctx, exec, rel9...) + if err != nil { + return err + } + } + } + } + + isFSPoolsDone, _ := organizationRelFSPoolsCtx.Value(ctx) + if !isFSPoolsDone && o.r.FSPools != nil { + ctx = organizationRelFSPoolsCtx.WithValue(ctx, true) + for _, r := range o.r.FSPools { + if r.o.alreadyPersisted { + m.R.FSPools = append(m.R.FSPools, r.o.Build()) + } else { + rel10, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSPools(ctx, exec, rel10...) + if err != nil { + return err + } + } + } + } + + isFSPooldetailsDone, _ := organizationRelFSPooldetailsCtx.Value(ctx) + if !isFSPooldetailsDone && o.r.FSPooldetails != nil { + ctx = organizationRelFSPooldetailsCtx.WithValue(ctx, true) + for _, r := range o.r.FSPooldetails { + if r.o.alreadyPersisted { + m.R.FSPooldetails = append(m.R.FSPooldetails, r.o.Build()) + } else { + rel11, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSPooldetails(ctx, exec, rel11...) + if err != nil { + return err + } + } + } + } + + isFSProposedtreatmentareasDone, _ := organizationRelFSProposedtreatmentareasCtx.Value(ctx) + if !isFSProposedtreatmentareasDone && o.r.FSProposedtreatmentareas != nil { + ctx = organizationRelFSProposedtreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.FSProposedtreatmentareas { + if r.o.alreadyPersisted { + m.R.FSProposedtreatmentareas = append(m.R.FSProposedtreatmentareas, r.o.Build()) + } else { + rel12, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSProposedtreatmentareas(ctx, exec, rel12...) + if err != nil { + return err + } + } + } + } + + isFSQamosquitoinspectionsDone, _ := organizationRelFSQamosquitoinspectionsCtx.Value(ctx) + if !isFSQamosquitoinspectionsDone && o.r.FSQamosquitoinspections != nil { + ctx = organizationRelFSQamosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.FSQamosquitoinspections { + if r.o.alreadyPersisted { + m.R.FSQamosquitoinspections = append(m.R.FSQamosquitoinspections, r.o.Build()) + } else { + rel13, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSQamosquitoinspections(ctx, exec, rel13...) + if err != nil { + return err + } + } + } + } + + isFSRodentlocationsDone, _ := organizationRelFSRodentlocationsCtx.Value(ctx) + if !isFSRodentlocationsDone && o.r.FSRodentlocations != nil { + ctx = organizationRelFSRodentlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSRodentlocations { + if r.o.alreadyPersisted { + m.R.FSRodentlocations = append(m.R.FSRodentlocations, r.o.Build()) + } else { + rel14, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSRodentlocations(ctx, exec, rel14...) + if err != nil { + return err + } + } + } + } + + isFSSamplecollectionsDone, _ := organizationRelFSSamplecollectionsCtx.Value(ctx) + if !isFSSamplecollectionsDone && o.r.FSSamplecollections != nil { + ctx = organizationRelFSSamplecollectionsCtx.WithValue(ctx, true) + for _, r := range o.r.FSSamplecollections { + if r.o.alreadyPersisted { + m.R.FSSamplecollections = append(m.R.FSSamplecollections, r.o.Build()) + } else { + rel15, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSSamplecollections(ctx, exec, rel15...) + if err != nil { + return err + } + } + } + } + + isFSSamplelocationsDone, _ := organizationRelFSSamplelocationsCtx.Value(ctx) + if !isFSSamplelocationsDone && o.r.FSSamplelocations != nil { + ctx = organizationRelFSSamplelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSSamplelocations { + if r.o.alreadyPersisted { + m.R.FSSamplelocations = append(m.R.FSSamplelocations, r.o.Build()) + } else { + rel16, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSSamplelocations(ctx, exec, rel16...) + if err != nil { + return err + } + } + } + } + + isFSServicerequestsDone, _ := organizationRelFSServicerequestsCtx.Value(ctx) + if !isFSServicerequestsDone && o.r.FSServicerequests != nil { + ctx = organizationRelFSServicerequestsCtx.WithValue(ctx, true) + for _, r := range o.r.FSServicerequests { + if r.o.alreadyPersisted { + m.R.FSServicerequests = append(m.R.FSServicerequests, r.o.Build()) + } else { + rel17, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSServicerequests(ctx, exec, rel17...) + if err != nil { + return err + } + } + } + } + + isFSSpeciesabundancesDone, _ := organizationRelFSSpeciesabundancesCtx.Value(ctx) + if !isFSSpeciesabundancesDone && o.r.FSSpeciesabundances != nil { + ctx = organizationRelFSSpeciesabundancesCtx.WithValue(ctx, true) + for _, r := range o.r.FSSpeciesabundances { + if r.o.alreadyPersisted { + m.R.FSSpeciesabundances = append(m.R.FSSpeciesabundances, r.o.Build()) + } else { + rel18, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSSpeciesabundances(ctx, exec, rel18...) + if err != nil { + return err + } + } + } + } + + isFSStormdrainsDone, _ := organizationRelFSStormdrainsCtx.Value(ctx) + if !isFSStormdrainsDone && o.r.FSStormdrains != nil { + ctx = organizationRelFSStormdrainsCtx.WithValue(ctx, true) + for _, r := range o.r.FSStormdrains { + if r.o.alreadyPersisted { + m.R.FSStormdrains = append(m.R.FSStormdrains, r.o.Build()) + } else { + rel19, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSStormdrains(ctx, exec, rel19...) + if err != nil { + return err + } + } + } + } + + isFSTimecardsDone, _ := organizationRelFSTimecardsCtx.Value(ctx) + if !isFSTimecardsDone && o.r.FSTimecards != nil { + ctx = organizationRelFSTimecardsCtx.WithValue(ctx, true) + for _, r := range o.r.FSTimecards { + if r.o.alreadyPersisted { + m.R.FSTimecards = append(m.R.FSTimecards, r.o.Build()) + } else { + rel20, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSTimecards(ctx, exec, rel20...) + if err != nil { + return err + } + } + } + } + + isFSTrapdataDone, _ := organizationRelFSTrapdataCtx.Value(ctx) + if !isFSTrapdataDone && o.r.FSTrapdata != nil { + ctx = organizationRelFSTrapdataCtx.WithValue(ctx, true) + for _, r := range o.r.FSTrapdata { + if r.o.alreadyPersisted { + m.R.FSTrapdata = append(m.R.FSTrapdata, r.o.Build()) + } else { + rel21, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSTrapdata(ctx, exec, rel21...) + if err != nil { + return err + } + } + } + } + + isFSTraplocationsDone, _ := organizationRelFSTraplocationsCtx.Value(ctx) + if !isFSTraplocationsDone && o.r.FSTraplocations != nil { + ctx = organizationRelFSTraplocationsCtx.WithValue(ctx, true) + for _, r := range o.r.FSTraplocations { + if r.o.alreadyPersisted { + m.R.FSTraplocations = append(m.R.FSTraplocations, r.o.Build()) + } else { + rel22, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSTraplocations(ctx, exec, rel22...) + if err != nil { + return err + } + } + } + } + + isFSTreatmentsDone, _ := organizationRelFSTreatmentsCtx.Value(ctx) + if !isFSTreatmentsDone && o.r.FSTreatments != nil { + ctx = organizationRelFSTreatmentsCtx.WithValue(ctx, true) + for _, r := range o.r.FSTreatments { + if r.o.alreadyPersisted { + m.R.FSTreatments = append(m.R.FSTreatments, r.o.Build()) + } else { + rel23, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSTreatments(ctx, exec, rel23...) + if err != nil { + return err + } + } + } + } + + isFSTreatmentareasDone, _ := organizationRelFSTreatmentareasCtx.Value(ctx) + if !isFSTreatmentareasDone && o.r.FSTreatmentareas != nil { + ctx = organizationRelFSTreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.FSTreatmentareas { + if r.o.alreadyPersisted { + m.R.FSTreatmentareas = append(m.R.FSTreatmentareas, r.o.Build()) + } else { + rel24, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSTreatmentareas(ctx, exec, rel24...) + if err != nil { + return err + } + } + } + } + + isFSZonesDone, _ := organizationRelFSZonesCtx.Value(ctx) + if !isFSZonesDone && o.r.FSZones != nil { + ctx = organizationRelFSZonesCtx.WithValue(ctx, true) + for _, r := range o.r.FSZones { + if r.o.alreadyPersisted { + m.R.FSZones = append(m.R.FSZones, r.o.Build()) + } else { + rel25, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSZones(ctx, exec, rel25...) + if err != nil { + return err + } + } + } + } + + isFSZones2sDone, _ := organizationRelFSZones2sCtx.Value(ctx) + if !isFSZones2sDone && o.r.FSZones2s != nil { + ctx = organizationRelFSZones2sCtx.WithValue(ctx, true) + for _, r := range o.r.FSZones2s { + if r.o.alreadyPersisted { + m.R.FSZones2s = append(m.R.FSZones2s, r.o.Build()) + } else { + rel26, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFSZones2s(ctx, exec, rel26...) + if err != nil { + return err + } + } + } + } + + isHistoryContainerrelatesDone, _ := organizationRelHistoryContainerrelatesCtx.Value(ctx) + if !isHistoryContainerrelatesDone && o.r.HistoryContainerrelates != nil { + ctx = organizationRelHistoryContainerrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryContainerrelates { + if r.o.alreadyPersisted { + m.R.HistoryContainerrelates = append(m.R.HistoryContainerrelates, r.o.Build()) + } else { + rel27, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryContainerrelates(ctx, exec, rel27...) + if err != nil { + return err + } + } + } + } + + isHistoryFieldscoutinglogsDone, _ := organizationRelHistoryFieldscoutinglogsCtx.Value(ctx) + if !isHistoryFieldscoutinglogsDone && o.r.HistoryFieldscoutinglogs != nil { + ctx = organizationRelHistoryFieldscoutinglogsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryFieldscoutinglogs { + if r.o.alreadyPersisted { + m.R.HistoryFieldscoutinglogs = append(m.R.HistoryFieldscoutinglogs, r.o.Build()) + } else { + rel28, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel28...) + if err != nil { + return err + } + } + } + } + + isHistoryHabitatrelatesDone, _ := organizationRelHistoryHabitatrelatesCtx.Value(ctx) + if !isHistoryHabitatrelatesDone && o.r.HistoryHabitatrelates != nil { + ctx = organizationRelHistoryHabitatrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryHabitatrelates { + if r.o.alreadyPersisted { + m.R.HistoryHabitatrelates = append(m.R.HistoryHabitatrelates, r.o.Build()) + } else { + rel29, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryHabitatrelates(ctx, exec, rel29...) + if err != nil { + return err + } + } + } + } + + isHistoryInspectionsamplesDone, _ := organizationRelHistoryInspectionsamplesCtx.Value(ctx) + if !isHistoryInspectionsamplesDone && o.r.HistoryInspectionsamples != nil { + ctx = organizationRelHistoryInspectionsamplesCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryInspectionsamples { + if r.o.alreadyPersisted { + m.R.HistoryInspectionsamples = append(m.R.HistoryInspectionsamples, r.o.Build()) + } else { + rel30, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryInspectionsamples(ctx, exec, rel30...) + if err != nil { + return err + } + } + } + } + + isHistoryInspectionsampledetailsDone, _ := organizationRelHistoryInspectionsampledetailsCtx.Value(ctx) + if !isHistoryInspectionsampledetailsDone && o.r.HistoryInspectionsampledetails != nil { + ctx = organizationRelHistoryInspectionsampledetailsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryInspectionsampledetails { + if r.o.alreadyPersisted { + m.R.HistoryInspectionsampledetails = append(m.R.HistoryInspectionsampledetails, r.o.Build()) + } else { + rel31, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel31...) + if err != nil { + return err + } + } + } + } + + isHistoryLinelocationsDone, _ := organizationRelHistoryLinelocationsCtx.Value(ctx) + if !isHistoryLinelocationsDone && o.r.HistoryLinelocations != nil { + ctx = organizationRelHistoryLinelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryLinelocations { + if r.o.alreadyPersisted { + m.R.HistoryLinelocations = append(m.R.HistoryLinelocations, r.o.Build()) + } else { + rel32, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryLinelocations(ctx, exec, rel32...) + if err != nil { + return err + } + } + } + } + + isHistoryLocationtrackingsDone, _ := organizationRelHistoryLocationtrackingsCtx.Value(ctx) + if !isHistoryLocationtrackingsDone && o.r.HistoryLocationtrackings != nil { + ctx = organizationRelHistoryLocationtrackingsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryLocationtrackings { + if r.o.alreadyPersisted { + m.R.HistoryLocationtrackings = append(m.R.HistoryLocationtrackings, r.o.Build()) + } else { + rel33, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryLocationtrackings(ctx, exec, rel33...) + if err != nil { + return err + } + } + } + } + + isHistoryMosquitoinspectionsDone, _ := organizationRelHistoryMosquitoinspectionsCtx.Value(ctx) + if !isHistoryMosquitoinspectionsDone && o.r.HistoryMosquitoinspections != nil { + ctx = organizationRelHistoryMosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryMosquitoinspections { + if r.o.alreadyPersisted { + m.R.HistoryMosquitoinspections = append(m.R.HistoryMosquitoinspections, r.o.Build()) + } else { + rel34, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryMosquitoinspections(ctx, exec, rel34...) + if err != nil { + return err + } + } + } + } + + isHistoryPointlocationsDone, _ := organizationRelHistoryPointlocationsCtx.Value(ctx) + if !isHistoryPointlocationsDone && o.r.HistoryPointlocations != nil { + ctx = organizationRelHistoryPointlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryPointlocations { + if r.o.alreadyPersisted { + m.R.HistoryPointlocations = append(m.R.HistoryPointlocations, r.o.Build()) + } else { + rel35, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryPointlocations(ctx, exec, rel35...) + if err != nil { + return err + } + } + } + } + + isHistoryPolygonlocationsDone, _ := organizationRelHistoryPolygonlocationsCtx.Value(ctx) + if !isHistoryPolygonlocationsDone && o.r.HistoryPolygonlocations != nil { + ctx = organizationRelHistoryPolygonlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryPolygonlocations { + if r.o.alreadyPersisted { + m.R.HistoryPolygonlocations = append(m.R.HistoryPolygonlocations, r.o.Build()) + } else { + rel36, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryPolygonlocations(ctx, exec, rel36...) + if err != nil { + return err + } + } + } + } + + isHistoryPoolsDone, _ := organizationRelHistoryPoolsCtx.Value(ctx) + if !isHistoryPoolsDone && o.r.HistoryPools != nil { + ctx = organizationRelHistoryPoolsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryPools { + if r.o.alreadyPersisted { + m.R.HistoryPools = append(m.R.HistoryPools, r.o.Build()) + } else { + rel37, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryPools(ctx, exec, rel37...) + if err != nil { + return err + } + } + } + } + + isHistoryPooldetailsDone, _ := organizationRelHistoryPooldetailsCtx.Value(ctx) + if !isHistoryPooldetailsDone && o.r.HistoryPooldetails != nil { + ctx = organizationRelHistoryPooldetailsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryPooldetails { + if r.o.alreadyPersisted { + m.R.HistoryPooldetails = append(m.R.HistoryPooldetails, r.o.Build()) + } else { + rel38, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryPooldetails(ctx, exec, rel38...) + if err != nil { + return err + } + } + } + } + + isHistoryProposedtreatmentareasDone, _ := organizationRelHistoryProposedtreatmentareasCtx.Value(ctx) + if !isHistoryProposedtreatmentareasDone && o.r.HistoryProposedtreatmentareas != nil { + ctx = organizationRelHistoryProposedtreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryProposedtreatmentareas { + if r.o.alreadyPersisted { + m.R.HistoryProposedtreatmentareas = append(m.R.HistoryProposedtreatmentareas, r.o.Build()) + } else { + rel39, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel39...) + if err != nil { + return err + } + } + } + } + + isHistoryQamosquitoinspectionsDone, _ := organizationRelHistoryQamosquitoinspectionsCtx.Value(ctx) + if !isHistoryQamosquitoinspectionsDone && o.r.HistoryQamosquitoinspections != nil { + ctx = organizationRelHistoryQamosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryQamosquitoinspections { + if r.o.alreadyPersisted { + m.R.HistoryQamosquitoinspections = append(m.R.HistoryQamosquitoinspections, r.o.Build()) + } else { + rel40, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel40...) + if err != nil { + return err + } + } + } + } + + isHistoryRodentlocationsDone, _ := organizationRelHistoryRodentlocationsCtx.Value(ctx) + if !isHistoryRodentlocationsDone && o.r.HistoryRodentlocations != nil { + ctx = organizationRelHistoryRodentlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryRodentlocations { + if r.o.alreadyPersisted { + m.R.HistoryRodentlocations = append(m.R.HistoryRodentlocations, r.o.Build()) + } else { + rel41, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryRodentlocations(ctx, exec, rel41...) + if err != nil { + return err + } + } + } + } + + isHistorySamplecollectionsDone, _ := organizationRelHistorySamplecollectionsCtx.Value(ctx) + if !isHistorySamplecollectionsDone && o.r.HistorySamplecollections != nil { + ctx = organizationRelHistorySamplecollectionsCtx.WithValue(ctx, true) + for _, r := range o.r.HistorySamplecollections { + if r.o.alreadyPersisted { + m.R.HistorySamplecollections = append(m.R.HistorySamplecollections, r.o.Build()) + } else { + rel42, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistorySamplecollections(ctx, exec, rel42...) + if err != nil { + return err + } + } + } + } + + isHistorySamplelocationsDone, _ := organizationRelHistorySamplelocationsCtx.Value(ctx) + if !isHistorySamplelocationsDone && o.r.HistorySamplelocations != nil { + ctx = organizationRelHistorySamplelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistorySamplelocations { + if r.o.alreadyPersisted { + m.R.HistorySamplelocations = append(m.R.HistorySamplelocations, r.o.Build()) + } else { + rel43, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistorySamplelocations(ctx, exec, rel43...) + if err != nil { + return err + } + } + } + } + + isHistoryServicerequestsDone, _ := organizationRelHistoryServicerequestsCtx.Value(ctx) + if !isHistoryServicerequestsDone && o.r.HistoryServicerequests != nil { + ctx = organizationRelHistoryServicerequestsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryServicerequests { + if r.o.alreadyPersisted { + m.R.HistoryServicerequests = append(m.R.HistoryServicerequests, r.o.Build()) + } else { + rel44, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryServicerequests(ctx, exec, rel44...) + if err != nil { + return err + } + } + } + } + + isHistorySpeciesabundancesDone, _ := organizationRelHistorySpeciesabundancesCtx.Value(ctx) + if !isHistorySpeciesabundancesDone && o.r.HistorySpeciesabundances != nil { + ctx = organizationRelHistorySpeciesabundancesCtx.WithValue(ctx, true) + for _, r := range o.r.HistorySpeciesabundances { + if r.o.alreadyPersisted { + m.R.HistorySpeciesabundances = append(m.R.HistorySpeciesabundances, r.o.Build()) + } else { + rel45, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistorySpeciesabundances(ctx, exec, rel45...) + if err != nil { + return err + } + } + } + } + + isHistoryStormdrainsDone, _ := organizationRelHistoryStormdrainsCtx.Value(ctx) + if !isHistoryStormdrainsDone && o.r.HistoryStormdrains != nil { + ctx = organizationRelHistoryStormdrainsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryStormdrains { + if r.o.alreadyPersisted { + m.R.HistoryStormdrains = append(m.R.HistoryStormdrains, r.o.Build()) + } else { + rel46, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryStormdrains(ctx, exec, rel46...) + if err != nil { + return err + } + } + } + } + + isHistoryTimecardsDone, _ := organizationRelHistoryTimecardsCtx.Value(ctx) + if !isHistoryTimecardsDone && o.r.HistoryTimecards != nil { + ctx = organizationRelHistoryTimecardsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryTimecards { + if r.o.alreadyPersisted { + m.R.HistoryTimecards = append(m.R.HistoryTimecards, r.o.Build()) + } else { + rel47, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryTimecards(ctx, exec, rel47...) + if err != nil { + return err + } + } + } + } + + isHistoryTrapdataDone, _ := organizationRelHistoryTrapdataCtx.Value(ctx) + if !isHistoryTrapdataDone && o.r.HistoryTrapdata != nil { + ctx = organizationRelHistoryTrapdataCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryTrapdata { + if r.o.alreadyPersisted { + m.R.HistoryTrapdata = append(m.R.HistoryTrapdata, r.o.Build()) + } else { + rel48, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryTrapdata(ctx, exec, rel48...) + if err != nil { + return err + } + } + } + } + + isHistoryTraplocationsDone, _ := organizationRelHistoryTraplocationsCtx.Value(ctx) + if !isHistoryTraplocationsDone && o.r.HistoryTraplocations != nil { + ctx = organizationRelHistoryTraplocationsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryTraplocations { + if r.o.alreadyPersisted { + m.R.HistoryTraplocations = append(m.R.HistoryTraplocations, r.o.Build()) + } else { + rel49, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryTraplocations(ctx, exec, rel49...) + if err != nil { + return err + } + } + } + } + + isHistoryTreatmentsDone, _ := organizationRelHistoryTreatmentsCtx.Value(ctx) + if !isHistoryTreatmentsDone && o.r.HistoryTreatments != nil { + ctx = organizationRelHistoryTreatmentsCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryTreatments { + if r.o.alreadyPersisted { + m.R.HistoryTreatments = append(m.R.HistoryTreatments, r.o.Build()) + } else { + rel50, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryTreatments(ctx, exec, rel50...) + if err != nil { + return err + } + } + } + } + + isHistoryTreatmentareasDone, _ := organizationRelHistoryTreatmentareasCtx.Value(ctx) + if !isHistoryTreatmentareasDone && o.r.HistoryTreatmentareas != nil { + ctx = organizationRelHistoryTreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryTreatmentareas { + if r.o.alreadyPersisted { + m.R.HistoryTreatmentareas = append(m.R.HistoryTreatmentareas, r.o.Build()) + } else { + rel51, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryTreatmentareas(ctx, exec, rel51...) + if err != nil { + return err + } + } + } + } + + isHistoryZonesDone, _ := organizationRelHistoryZonesCtx.Value(ctx) + if !isHistoryZonesDone && o.r.HistoryZones != nil { + ctx = organizationRelHistoryZonesCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryZones { + if r.o.alreadyPersisted { + m.R.HistoryZones = append(m.R.HistoryZones, r.o.Build()) + } else { + rel52, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryZones(ctx, exec, rel52...) + if err != nil { + return err + } + } + } + } + + isHistoryZones2sDone, _ := organizationRelHistoryZones2sCtx.Value(ctx) + if !isHistoryZones2sDone && o.r.HistoryZones2s != nil { + ctx = organizationRelHistoryZones2sCtx.WithValue(ctx, true) + for _, r := range o.r.HistoryZones2s { + if r.o.alreadyPersisted { + m.R.HistoryZones2s = append(m.R.HistoryZones2s, r.o.Build()) + } else { + rel53, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHistoryZones2s(ctx, exec, rel53...) + if err != nil { + return err + } + } + } + } + isUserDone, _ := organizationRelUserCtx.Value(ctx) if !isUserDone && o.r.User != nil { ctx = organizationRelUserCtx.WithValue(ctx, true) @@ -170,12 +2230,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 { - rel0, err := r.o.CreateMany(ctx, exec, r.number) + rel54, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachUser(ctx, exec, rel0...) + err = m.AttachUser(ctx, exec, rel54...) if err != nil { return err } @@ -279,6 +2339,7 @@ func (m organizationMods) RandomizeAllColumns(f *faker.Faker) OrganizationMod { OrganizationMods.RandomName(f), OrganizationMods.RandomArcgisID(f), OrganizationMods.RandomArcgisName(f), + OrganizationMods.RandomFieldseekerURL(f), } } @@ -472,6 +2533,59 @@ func (m organizationMods) RandomArcgisNameNotNull(f *faker.Faker) OrganizationMo }) } +// Set the model columns to this value +func (m organizationMods) FieldseekerURL(val null.Val[string]) OrganizationMod { + return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { + o.FieldseekerURL = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m organizationMods) FieldseekerURLFunc(f func() null.Val[string]) OrganizationMod { + return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { + o.FieldseekerURL = f + }) +} + +// Clear any values for the column +func (m organizationMods) UnsetFieldseekerURL() OrganizationMod { + return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { + o.FieldseekerURL = 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 organizationMods) RandomFieldseekerURL(f *faker.Faker) OrganizationMod { + return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { + o.FieldseekerURL = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(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 organizationMods) RandomFieldseekerURLNotNull(f *faker.Faker) OrganizationMod { + return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { + o.FieldseekerURL = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + func (m organizationMods) WithParentsCascading() OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { if isDone, _ := organizationWithParentsCascadingCtx.Value(ctx); isDone { @@ -481,6 +2595,2598 @@ func (m organizationMods) WithParentsCascading() OrganizationMod { }) } +func (m organizationMods) WithFSContainerrelates(number int, related *FSContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSContainerrelates = []*organizationRFSContainerrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSContainerrelates(number int, mods ...FSContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSContainerrelateWithContext(ctx, mods...) + m.WithFSContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSContainerrelates(number int, related *FSContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSContainerrelates = append(o.r.FSContainerrelates, &organizationRFSContainerrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSContainerrelates(number int, mods ...FSContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSContainerrelateWithContext(ctx, mods...) + m.AddFSContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSContainerrelates(existingModels ...*models.FSContainerrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSContainerrelates = append(o.r.FSContainerrelates, &organizationRFSContainerrelatesR{ + o: o.f.FromExistingFSContainerrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSContainerrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSContainerrelates = nil + }) +} + +func (m organizationMods) WithFSFieldscoutinglogs(number int, related *FSFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSFieldscoutinglogs = []*organizationRFSFieldscoutinglogsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSFieldscoutinglogs(number int, mods ...FSFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSFieldscoutinglogWithContext(ctx, mods...) + m.WithFSFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSFieldscoutinglogs(number int, related *FSFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSFieldscoutinglogs = append(o.r.FSFieldscoutinglogs, &organizationRFSFieldscoutinglogsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSFieldscoutinglogs(number int, mods ...FSFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSFieldscoutinglogWithContext(ctx, mods...) + m.AddFSFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSFieldscoutinglogs(existingModels ...*models.FSFieldscoutinglog) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSFieldscoutinglogs = append(o.r.FSFieldscoutinglogs, &organizationRFSFieldscoutinglogsR{ + o: o.f.FromExistingFSFieldscoutinglog(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSFieldscoutinglogs() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSFieldscoutinglogs = nil + }) +} + +func (m organizationMods) WithFSHabitatrelates(number int, related *FSHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSHabitatrelates = []*organizationRFSHabitatrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSHabitatrelates(number int, mods ...FSHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSHabitatrelateWithContext(ctx, mods...) + m.WithFSHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSHabitatrelates(number int, related *FSHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSHabitatrelates = append(o.r.FSHabitatrelates, &organizationRFSHabitatrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSHabitatrelates(number int, mods ...FSHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSHabitatrelateWithContext(ctx, mods...) + m.AddFSHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSHabitatrelates(existingModels ...*models.FSHabitatrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSHabitatrelates = append(o.r.FSHabitatrelates, &organizationRFSHabitatrelatesR{ + o: o.f.FromExistingFSHabitatrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSHabitatrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSHabitatrelates = nil + }) +} + +func (m organizationMods) WithFSInspectionsamples(number int, related *FSInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsamples = []*organizationRFSInspectionsamplesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSInspectionsamples(number int, mods ...FSInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSInspectionsampleWithContext(ctx, mods...) + m.WithFSInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSInspectionsamples(number int, related *FSInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsamples = append(o.r.FSInspectionsamples, &organizationRFSInspectionsamplesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSInspectionsamples(number int, mods ...FSInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSInspectionsampleWithContext(ctx, mods...) + m.AddFSInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSInspectionsamples(existingModels ...*models.FSInspectionsample) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSInspectionsamples = append(o.r.FSInspectionsamples, &organizationRFSInspectionsamplesR{ + o: o.f.FromExistingFSInspectionsample(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSInspectionsamples() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsamples = nil + }) +} + +func (m organizationMods) WithFSInspectionsampledetails(number int, related *FSInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsampledetails = []*organizationRFSInspectionsampledetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSInspectionsampledetails(number int, mods ...FSInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSInspectionsampledetailWithContext(ctx, mods...) + m.WithFSInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSInspectionsampledetails(number int, related *FSInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsampledetails = append(o.r.FSInspectionsampledetails, &organizationRFSInspectionsampledetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSInspectionsampledetails(number int, mods ...FSInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSInspectionsampledetailWithContext(ctx, mods...) + m.AddFSInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSInspectionsampledetails(existingModels ...*models.FSInspectionsampledetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSInspectionsampledetails = append(o.r.FSInspectionsampledetails, &organizationRFSInspectionsampledetailsR{ + o: o.f.FromExistingFSInspectionsampledetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSInspectionsampledetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSInspectionsampledetails = nil + }) +} + +func (m organizationMods) WithFSLinelocations(number int, related *FSLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLinelocations = []*organizationRFSLinelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSLinelocations(number int, mods ...FSLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSLinelocationWithContext(ctx, mods...) + m.WithFSLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSLinelocations(number int, related *FSLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLinelocations = append(o.r.FSLinelocations, &organizationRFSLinelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSLinelocations(number int, mods ...FSLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSLinelocationWithContext(ctx, mods...) + m.AddFSLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSLinelocations(existingModels ...*models.FSLinelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSLinelocations = append(o.r.FSLinelocations, &organizationRFSLinelocationsR{ + o: o.f.FromExistingFSLinelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSLinelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLinelocations = nil + }) +} + +func (m organizationMods) WithFSLocationtrackings(number int, related *FSLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLocationtrackings = []*organizationRFSLocationtrackingsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSLocationtrackings(number int, mods ...FSLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSLocationtrackingWithContext(ctx, mods...) + m.WithFSLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSLocationtrackings(number int, related *FSLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLocationtrackings = append(o.r.FSLocationtrackings, &organizationRFSLocationtrackingsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSLocationtrackings(number int, mods ...FSLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSLocationtrackingWithContext(ctx, mods...) + m.AddFSLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSLocationtrackings(existingModels ...*models.FSLocationtracking) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSLocationtrackings = append(o.r.FSLocationtrackings, &organizationRFSLocationtrackingsR{ + o: o.f.FromExistingFSLocationtracking(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSLocationtrackings() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSLocationtrackings = nil + }) +} + +func (m organizationMods) WithFSMosquitoinspections(number int, related *FSMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSMosquitoinspections = []*organizationRFSMosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSMosquitoinspections(number int, mods ...FSMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSMosquitoinspectionWithContext(ctx, mods...) + m.WithFSMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSMosquitoinspections(number int, related *FSMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSMosquitoinspections = append(o.r.FSMosquitoinspections, &organizationRFSMosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSMosquitoinspections(number int, mods ...FSMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSMosquitoinspectionWithContext(ctx, mods...) + m.AddFSMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSMosquitoinspections(existingModels ...*models.FSMosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSMosquitoinspections = append(o.r.FSMosquitoinspections, &organizationRFSMosquitoinspectionsR{ + o: o.f.FromExistingFSMosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSMosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSMosquitoinspections = nil + }) +} + +func (m organizationMods) WithFSPointlocations(number int, related *FSPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPointlocations = []*organizationRFSPointlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSPointlocations(number int, mods ...FSPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPointlocationWithContext(ctx, mods...) + m.WithFSPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSPointlocations(number int, related *FSPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPointlocations = append(o.r.FSPointlocations, &organizationRFSPointlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSPointlocations(number int, mods ...FSPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPointlocationWithContext(ctx, mods...) + m.AddFSPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSPointlocations(existingModels ...*models.FSPointlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSPointlocations = append(o.r.FSPointlocations, &organizationRFSPointlocationsR{ + o: o.f.FromExistingFSPointlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSPointlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPointlocations = nil + }) +} + +func (m organizationMods) WithFSPolygonlocations(number int, related *FSPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPolygonlocations = []*organizationRFSPolygonlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSPolygonlocations(number int, mods ...FSPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPolygonlocationWithContext(ctx, mods...) + m.WithFSPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSPolygonlocations(number int, related *FSPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPolygonlocations = append(o.r.FSPolygonlocations, &organizationRFSPolygonlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSPolygonlocations(number int, mods ...FSPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPolygonlocationWithContext(ctx, mods...) + m.AddFSPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSPolygonlocations(existingModels ...*models.FSPolygonlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSPolygonlocations = append(o.r.FSPolygonlocations, &organizationRFSPolygonlocationsR{ + o: o.f.FromExistingFSPolygonlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSPolygonlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPolygonlocations = nil + }) +} + +func (m organizationMods) WithFSPools(number int, related *FSPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPools = []*organizationRFSPoolsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSPools(number int, mods ...FSPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPoolWithContext(ctx, mods...) + m.WithFSPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSPools(number int, related *FSPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPools = append(o.r.FSPools, &organizationRFSPoolsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSPools(number int, mods ...FSPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPoolWithContext(ctx, mods...) + m.AddFSPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSPools(existingModels ...*models.FSPool) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSPools = append(o.r.FSPools, &organizationRFSPoolsR{ + o: o.f.FromExistingFSPool(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSPools() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPools = nil + }) +} + +func (m organizationMods) WithFSPooldetails(number int, related *FSPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPooldetails = []*organizationRFSPooldetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSPooldetails(number int, mods ...FSPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPooldetailWithContext(ctx, mods...) + m.WithFSPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSPooldetails(number int, related *FSPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPooldetails = append(o.r.FSPooldetails, &organizationRFSPooldetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSPooldetails(number int, mods ...FSPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSPooldetailWithContext(ctx, mods...) + m.AddFSPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSPooldetails(existingModels ...*models.FSPooldetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSPooldetails = append(o.r.FSPooldetails, &organizationRFSPooldetailsR{ + o: o.f.FromExistingFSPooldetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSPooldetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSPooldetails = nil + }) +} + +func (m organizationMods) WithFSProposedtreatmentareas(number int, related *FSProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSProposedtreatmentareas = []*organizationRFSProposedtreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSProposedtreatmentareas(number int, mods ...FSProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSProposedtreatmentareaWithContext(ctx, mods...) + m.WithFSProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSProposedtreatmentareas(number int, related *FSProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSProposedtreatmentareas = append(o.r.FSProposedtreatmentareas, &organizationRFSProposedtreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSProposedtreatmentareas(number int, mods ...FSProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSProposedtreatmentareaWithContext(ctx, mods...) + m.AddFSProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSProposedtreatmentareas(existingModels ...*models.FSProposedtreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSProposedtreatmentareas = append(o.r.FSProposedtreatmentareas, &organizationRFSProposedtreatmentareasR{ + o: o.f.FromExistingFSProposedtreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSProposedtreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSProposedtreatmentareas = nil + }) +} + +func (m organizationMods) WithFSQamosquitoinspections(number int, related *FSQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSQamosquitoinspections = []*organizationRFSQamosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSQamosquitoinspections(number int, mods ...FSQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSQamosquitoinspectionWithContext(ctx, mods...) + m.WithFSQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSQamosquitoinspections(number int, related *FSQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSQamosquitoinspections = append(o.r.FSQamosquitoinspections, &organizationRFSQamosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSQamosquitoinspections(number int, mods ...FSQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSQamosquitoinspectionWithContext(ctx, mods...) + m.AddFSQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSQamosquitoinspections(existingModels ...*models.FSQamosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSQamosquitoinspections = append(o.r.FSQamosquitoinspections, &organizationRFSQamosquitoinspectionsR{ + o: o.f.FromExistingFSQamosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSQamosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSQamosquitoinspections = nil + }) +} + +func (m organizationMods) WithFSRodentlocations(number int, related *FSRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSRodentlocations = []*organizationRFSRodentlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSRodentlocations(number int, mods ...FSRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSRodentlocationWithContext(ctx, mods...) + m.WithFSRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSRodentlocations(number int, related *FSRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSRodentlocations = append(o.r.FSRodentlocations, &organizationRFSRodentlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSRodentlocations(number int, mods ...FSRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSRodentlocationWithContext(ctx, mods...) + m.AddFSRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSRodentlocations(existingModels ...*models.FSRodentlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSRodentlocations = append(o.r.FSRodentlocations, &organizationRFSRodentlocationsR{ + o: o.f.FromExistingFSRodentlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSRodentlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSRodentlocations = nil + }) +} + +func (m organizationMods) WithFSSamplecollections(number int, related *FSSamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplecollections = []*organizationRFSSamplecollectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSSamplecollections(number int, mods ...FSSamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSamplecollectionWithContext(ctx, mods...) + m.WithFSSamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSSamplecollections(number int, related *FSSamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplecollections = append(o.r.FSSamplecollections, &organizationRFSSamplecollectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSSamplecollections(number int, mods ...FSSamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSamplecollectionWithContext(ctx, mods...) + m.AddFSSamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSSamplecollections(existingModels ...*models.FSSamplecollection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSSamplecollections = append(o.r.FSSamplecollections, &organizationRFSSamplecollectionsR{ + o: o.f.FromExistingFSSamplecollection(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSSamplecollections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplecollections = nil + }) +} + +func (m organizationMods) WithFSSamplelocations(number int, related *FSSamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplelocations = []*organizationRFSSamplelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSSamplelocations(number int, mods ...FSSamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSamplelocationWithContext(ctx, mods...) + m.WithFSSamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSSamplelocations(number int, related *FSSamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplelocations = append(o.r.FSSamplelocations, &organizationRFSSamplelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSSamplelocations(number int, mods ...FSSamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSamplelocationWithContext(ctx, mods...) + m.AddFSSamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSSamplelocations(existingModels ...*models.FSSamplelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSSamplelocations = append(o.r.FSSamplelocations, &organizationRFSSamplelocationsR{ + o: o.f.FromExistingFSSamplelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSSamplelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSamplelocations = nil + }) +} + +func (m organizationMods) WithFSServicerequests(number int, related *FSServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSServicerequests = []*organizationRFSServicerequestsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSServicerequests(number int, mods ...FSServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSServicerequestWithContext(ctx, mods...) + m.WithFSServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSServicerequests(number int, related *FSServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSServicerequests = append(o.r.FSServicerequests, &organizationRFSServicerequestsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSServicerequests(number int, mods ...FSServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSServicerequestWithContext(ctx, mods...) + m.AddFSServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSServicerequests(existingModels ...*models.FSServicerequest) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSServicerequests = append(o.r.FSServicerequests, &organizationRFSServicerequestsR{ + o: o.f.FromExistingFSServicerequest(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSServicerequests() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSServicerequests = nil + }) +} + +func (m organizationMods) WithFSSpeciesabundances(number int, related *FSSpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSpeciesabundances = []*organizationRFSSpeciesabundancesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSSpeciesabundances(number int, mods ...FSSpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSpeciesabundanceWithContext(ctx, mods...) + m.WithFSSpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSSpeciesabundances(number int, related *FSSpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSpeciesabundances = append(o.r.FSSpeciesabundances, &organizationRFSSpeciesabundancesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSSpeciesabundances(number int, mods ...FSSpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSSpeciesabundanceWithContext(ctx, mods...) + m.AddFSSpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSSpeciesabundances(existingModels ...*models.FSSpeciesabundance) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSSpeciesabundances = append(o.r.FSSpeciesabundances, &organizationRFSSpeciesabundancesR{ + o: o.f.FromExistingFSSpeciesabundance(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSSpeciesabundances() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSSpeciesabundances = nil + }) +} + +func (m organizationMods) WithFSStormdrains(number int, related *FSStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSStormdrains = []*organizationRFSStormdrainsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSStormdrains(number int, mods ...FSStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSStormdrainWithContext(ctx, mods...) + m.WithFSStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSStormdrains(number int, related *FSStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSStormdrains = append(o.r.FSStormdrains, &organizationRFSStormdrainsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSStormdrains(number int, mods ...FSStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSStormdrainWithContext(ctx, mods...) + m.AddFSStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSStormdrains(existingModels ...*models.FSStormdrain) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSStormdrains = append(o.r.FSStormdrains, &organizationRFSStormdrainsR{ + o: o.f.FromExistingFSStormdrain(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSStormdrains() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSStormdrains = nil + }) +} + +func (m organizationMods) WithFSTimecards(number int, related *FSTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTimecards = []*organizationRFSTimecardsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSTimecards(number int, mods ...FSTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTimecardWithContext(ctx, mods...) + m.WithFSTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSTimecards(number int, related *FSTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTimecards = append(o.r.FSTimecards, &organizationRFSTimecardsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSTimecards(number int, mods ...FSTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTimecardWithContext(ctx, mods...) + m.AddFSTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSTimecards(existingModels ...*models.FSTimecard) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSTimecards = append(o.r.FSTimecards, &organizationRFSTimecardsR{ + o: o.f.FromExistingFSTimecard(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSTimecards() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTimecards = nil + }) +} + +func (m organizationMods) WithFSTrapdata(number int, related *FSTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTrapdata = []*organizationRFSTrapdataR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSTrapdata(number int, mods ...FSTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTrapdatumWithContext(ctx, mods...) + m.WithFSTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSTrapdata(number int, related *FSTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTrapdata = append(o.r.FSTrapdata, &organizationRFSTrapdataR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSTrapdata(number int, mods ...FSTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTrapdatumWithContext(ctx, mods...) + m.AddFSTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSTrapdata(existingModels ...*models.FSTrapdatum) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSTrapdata = append(o.r.FSTrapdata, &organizationRFSTrapdataR{ + o: o.f.FromExistingFSTrapdatum(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSTrapdata() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTrapdata = nil + }) +} + +func (m organizationMods) WithFSTraplocations(number int, related *FSTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTraplocations = []*organizationRFSTraplocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSTraplocations(number int, mods ...FSTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTraplocationWithContext(ctx, mods...) + m.WithFSTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSTraplocations(number int, related *FSTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTraplocations = append(o.r.FSTraplocations, &organizationRFSTraplocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSTraplocations(number int, mods ...FSTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTraplocationWithContext(ctx, mods...) + m.AddFSTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSTraplocations(existingModels ...*models.FSTraplocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSTraplocations = append(o.r.FSTraplocations, &organizationRFSTraplocationsR{ + o: o.f.FromExistingFSTraplocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSTraplocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTraplocations = nil + }) +} + +func (m organizationMods) WithFSTreatments(number int, related *FSTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatments = []*organizationRFSTreatmentsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSTreatments(number int, mods ...FSTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTreatmentWithContext(ctx, mods...) + m.WithFSTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSTreatments(number int, related *FSTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatments = append(o.r.FSTreatments, &organizationRFSTreatmentsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSTreatments(number int, mods ...FSTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTreatmentWithContext(ctx, mods...) + m.AddFSTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSTreatments(existingModels ...*models.FSTreatment) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSTreatments = append(o.r.FSTreatments, &organizationRFSTreatmentsR{ + o: o.f.FromExistingFSTreatment(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSTreatments() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatments = nil + }) +} + +func (m organizationMods) WithFSTreatmentareas(number int, related *FSTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatmentareas = []*organizationRFSTreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSTreatmentareas(number int, mods ...FSTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTreatmentareaWithContext(ctx, mods...) + m.WithFSTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSTreatmentareas(number int, related *FSTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatmentareas = append(o.r.FSTreatmentareas, &organizationRFSTreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSTreatmentareas(number int, mods ...FSTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSTreatmentareaWithContext(ctx, mods...) + m.AddFSTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSTreatmentareas(existingModels ...*models.FSTreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSTreatmentareas = append(o.r.FSTreatmentareas, &organizationRFSTreatmentareasR{ + o: o.f.FromExistingFSTreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSTreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSTreatmentareas = nil + }) +} + +func (m organizationMods) WithFSZones(number int, related *FSZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones = []*organizationRFSZonesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSZones(number int, mods ...FSZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSZoneWithContext(ctx, mods...) + m.WithFSZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSZones(number int, related *FSZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones = append(o.r.FSZones, &organizationRFSZonesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSZones(number int, mods ...FSZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSZoneWithContext(ctx, mods...) + m.AddFSZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSZones(existingModels ...*models.FSZone) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSZones = append(o.r.FSZones, &organizationRFSZonesR{ + o: o.f.FromExistingFSZone(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSZones() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones = nil + }) +} + +func (m organizationMods) WithFSZones2s(number int, related *FSZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones2s = []*organizationRFSZones2sR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFSZones2s(number int, mods ...FSZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSZones2WithContext(ctx, mods...) + m.WithFSZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFSZones2s(number int, related *FSZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones2s = append(o.r.FSZones2s, &organizationRFSZones2sR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFSZones2s(number int, mods ...FSZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFSZones2WithContext(ctx, mods...) + m.AddFSZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFSZones2s(existingModels ...*models.FSZones2) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FSZones2s = append(o.r.FSZones2s, &organizationRFSZones2sR{ + o: o.f.FromExistingFSZones2(em), + }) + } + }) +} + +func (m organizationMods) WithoutFSZones2s() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FSZones2s = nil + }) +} + +func (m organizationMods) WithHistoryContainerrelates(number int, related *HistoryContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryContainerrelates = []*organizationRHistoryContainerrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryContainerrelates(number int, mods ...HistoryContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryContainerrelateWithContext(ctx, mods...) + m.WithHistoryContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryContainerrelates(number int, related *HistoryContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryContainerrelates = append(o.r.HistoryContainerrelates, &organizationRHistoryContainerrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryContainerrelates(number int, mods ...HistoryContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryContainerrelateWithContext(ctx, mods...) + m.AddHistoryContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryContainerrelates(existingModels ...*models.HistoryContainerrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryContainerrelates = append(o.r.HistoryContainerrelates, &organizationRHistoryContainerrelatesR{ + o: o.f.FromExistingHistoryContainerrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryContainerrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryContainerrelates = nil + }) +} + +func (m organizationMods) WithHistoryFieldscoutinglogs(number int, related *HistoryFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryFieldscoutinglogs = []*organizationRHistoryFieldscoutinglogsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryFieldscoutinglogs(number int, mods ...HistoryFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryFieldscoutinglogWithContext(ctx, mods...) + m.WithHistoryFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryFieldscoutinglogs(number int, related *HistoryFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryFieldscoutinglogs = append(o.r.HistoryFieldscoutinglogs, &organizationRHistoryFieldscoutinglogsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryFieldscoutinglogs(number int, mods ...HistoryFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryFieldscoutinglogWithContext(ctx, mods...) + m.AddHistoryFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryFieldscoutinglogs(existingModels ...*models.HistoryFieldscoutinglog) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryFieldscoutinglogs = append(o.r.HistoryFieldscoutinglogs, &organizationRHistoryFieldscoutinglogsR{ + o: o.f.FromExistingHistoryFieldscoutinglog(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryFieldscoutinglogs() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryFieldscoutinglogs = nil + }) +} + +func (m organizationMods) WithHistoryHabitatrelates(number int, related *HistoryHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryHabitatrelates = []*organizationRHistoryHabitatrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryHabitatrelates(number int, mods ...HistoryHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryHabitatrelateWithContext(ctx, mods...) + m.WithHistoryHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryHabitatrelates(number int, related *HistoryHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryHabitatrelates = append(o.r.HistoryHabitatrelates, &organizationRHistoryHabitatrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryHabitatrelates(number int, mods ...HistoryHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryHabitatrelateWithContext(ctx, mods...) + m.AddHistoryHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryHabitatrelates(existingModels ...*models.HistoryHabitatrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryHabitatrelates = append(o.r.HistoryHabitatrelates, &organizationRHistoryHabitatrelatesR{ + o: o.f.FromExistingHistoryHabitatrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryHabitatrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryHabitatrelates = nil + }) +} + +func (m organizationMods) WithHistoryInspectionsamples(number int, related *HistoryInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsamples = []*organizationRHistoryInspectionsamplesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryInspectionsamples(number int, mods ...HistoryInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryInspectionsampleWithContext(ctx, mods...) + m.WithHistoryInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryInspectionsamples(number int, related *HistoryInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsamples = append(o.r.HistoryInspectionsamples, &organizationRHistoryInspectionsamplesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryInspectionsamples(number int, mods ...HistoryInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryInspectionsampleWithContext(ctx, mods...) + m.AddHistoryInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryInspectionsamples(existingModels ...*models.HistoryInspectionsample) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryInspectionsamples = append(o.r.HistoryInspectionsamples, &organizationRHistoryInspectionsamplesR{ + o: o.f.FromExistingHistoryInspectionsample(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryInspectionsamples() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsamples = nil + }) +} + +func (m organizationMods) WithHistoryInspectionsampledetails(number int, related *HistoryInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsampledetails = []*organizationRHistoryInspectionsampledetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryInspectionsampledetails(number int, mods ...HistoryInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryInspectionsampledetailWithContext(ctx, mods...) + m.WithHistoryInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryInspectionsampledetails(number int, related *HistoryInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsampledetails = append(o.r.HistoryInspectionsampledetails, &organizationRHistoryInspectionsampledetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryInspectionsampledetails(number int, mods ...HistoryInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryInspectionsampledetailWithContext(ctx, mods...) + m.AddHistoryInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryInspectionsampledetails(existingModels ...*models.HistoryInspectionsampledetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryInspectionsampledetails = append(o.r.HistoryInspectionsampledetails, &organizationRHistoryInspectionsampledetailsR{ + o: o.f.FromExistingHistoryInspectionsampledetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryInspectionsampledetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryInspectionsampledetails = nil + }) +} + +func (m organizationMods) WithHistoryLinelocations(number int, related *HistoryLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLinelocations = []*organizationRHistoryLinelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryLinelocations(number int, mods ...HistoryLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryLinelocationWithContext(ctx, mods...) + m.WithHistoryLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryLinelocations(number int, related *HistoryLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLinelocations = append(o.r.HistoryLinelocations, &organizationRHistoryLinelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryLinelocations(number int, mods ...HistoryLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryLinelocationWithContext(ctx, mods...) + m.AddHistoryLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryLinelocations(existingModels ...*models.HistoryLinelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryLinelocations = append(o.r.HistoryLinelocations, &organizationRHistoryLinelocationsR{ + o: o.f.FromExistingHistoryLinelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryLinelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLinelocations = nil + }) +} + +func (m organizationMods) WithHistoryLocationtrackings(number int, related *HistoryLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLocationtrackings = []*organizationRHistoryLocationtrackingsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryLocationtrackings(number int, mods ...HistoryLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryLocationtrackingWithContext(ctx, mods...) + m.WithHistoryLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryLocationtrackings(number int, related *HistoryLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLocationtrackings = append(o.r.HistoryLocationtrackings, &organizationRHistoryLocationtrackingsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryLocationtrackings(number int, mods ...HistoryLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryLocationtrackingWithContext(ctx, mods...) + m.AddHistoryLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryLocationtrackings(existingModels ...*models.HistoryLocationtracking) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryLocationtrackings = append(o.r.HistoryLocationtrackings, &organizationRHistoryLocationtrackingsR{ + o: o.f.FromExistingHistoryLocationtracking(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryLocationtrackings() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryLocationtrackings = nil + }) +} + +func (m organizationMods) WithHistoryMosquitoinspections(number int, related *HistoryMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryMosquitoinspections = []*organizationRHistoryMosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryMosquitoinspections(number int, mods ...HistoryMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryMosquitoinspectionWithContext(ctx, mods...) + m.WithHistoryMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryMosquitoinspections(number int, related *HistoryMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryMosquitoinspections = append(o.r.HistoryMosquitoinspections, &organizationRHistoryMosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryMosquitoinspections(number int, mods ...HistoryMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryMosquitoinspectionWithContext(ctx, mods...) + m.AddHistoryMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryMosquitoinspections(existingModels ...*models.HistoryMosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryMosquitoinspections = append(o.r.HistoryMosquitoinspections, &organizationRHistoryMosquitoinspectionsR{ + o: o.f.FromExistingHistoryMosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryMosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryMosquitoinspections = nil + }) +} + +func (m organizationMods) WithHistoryPointlocations(number int, related *HistoryPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPointlocations = []*organizationRHistoryPointlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryPointlocations(number int, mods ...HistoryPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPointlocationWithContext(ctx, mods...) + m.WithHistoryPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryPointlocations(number int, related *HistoryPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPointlocations = append(o.r.HistoryPointlocations, &organizationRHistoryPointlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryPointlocations(number int, mods ...HistoryPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPointlocationWithContext(ctx, mods...) + m.AddHistoryPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryPointlocations(existingModels ...*models.HistoryPointlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryPointlocations = append(o.r.HistoryPointlocations, &organizationRHistoryPointlocationsR{ + o: o.f.FromExistingHistoryPointlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryPointlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPointlocations = nil + }) +} + +func (m organizationMods) WithHistoryPolygonlocations(number int, related *HistoryPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPolygonlocations = []*organizationRHistoryPolygonlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryPolygonlocations(number int, mods ...HistoryPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPolygonlocationWithContext(ctx, mods...) + m.WithHistoryPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryPolygonlocations(number int, related *HistoryPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPolygonlocations = append(o.r.HistoryPolygonlocations, &organizationRHistoryPolygonlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryPolygonlocations(number int, mods ...HistoryPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPolygonlocationWithContext(ctx, mods...) + m.AddHistoryPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryPolygonlocations(existingModels ...*models.HistoryPolygonlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryPolygonlocations = append(o.r.HistoryPolygonlocations, &organizationRHistoryPolygonlocationsR{ + o: o.f.FromExistingHistoryPolygonlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryPolygonlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPolygonlocations = nil + }) +} + +func (m organizationMods) WithHistoryPools(number int, related *HistoryPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPools = []*organizationRHistoryPoolsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryPools(number int, mods ...HistoryPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPoolWithContext(ctx, mods...) + m.WithHistoryPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryPools(number int, related *HistoryPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPools = append(o.r.HistoryPools, &organizationRHistoryPoolsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryPools(number int, mods ...HistoryPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPoolWithContext(ctx, mods...) + m.AddHistoryPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryPools(existingModels ...*models.HistoryPool) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryPools = append(o.r.HistoryPools, &organizationRHistoryPoolsR{ + o: o.f.FromExistingHistoryPool(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryPools() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPools = nil + }) +} + +func (m organizationMods) WithHistoryPooldetails(number int, related *HistoryPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPooldetails = []*organizationRHistoryPooldetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryPooldetails(number int, mods ...HistoryPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPooldetailWithContext(ctx, mods...) + m.WithHistoryPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryPooldetails(number int, related *HistoryPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPooldetails = append(o.r.HistoryPooldetails, &organizationRHistoryPooldetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryPooldetails(number int, mods ...HistoryPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryPooldetailWithContext(ctx, mods...) + m.AddHistoryPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryPooldetails(existingModels ...*models.HistoryPooldetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryPooldetails = append(o.r.HistoryPooldetails, &organizationRHistoryPooldetailsR{ + o: o.f.FromExistingHistoryPooldetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryPooldetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryPooldetails = nil + }) +} + +func (m organizationMods) WithHistoryProposedtreatmentareas(number int, related *HistoryProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryProposedtreatmentareas = []*organizationRHistoryProposedtreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryProposedtreatmentareas(number int, mods ...HistoryProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryProposedtreatmentareaWithContext(ctx, mods...) + m.WithHistoryProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryProposedtreatmentareas(number int, related *HistoryProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryProposedtreatmentareas = append(o.r.HistoryProposedtreatmentareas, &organizationRHistoryProposedtreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryProposedtreatmentareas(number int, mods ...HistoryProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryProposedtreatmentareaWithContext(ctx, mods...) + m.AddHistoryProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryProposedtreatmentareas(existingModels ...*models.HistoryProposedtreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryProposedtreatmentareas = append(o.r.HistoryProposedtreatmentareas, &organizationRHistoryProposedtreatmentareasR{ + o: o.f.FromExistingHistoryProposedtreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryProposedtreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryProposedtreatmentareas = nil + }) +} + +func (m organizationMods) WithHistoryQamosquitoinspections(number int, related *HistoryQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryQamosquitoinspections = []*organizationRHistoryQamosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryQamosquitoinspections(number int, mods ...HistoryQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryQamosquitoinspectionWithContext(ctx, mods...) + m.WithHistoryQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryQamosquitoinspections(number int, related *HistoryQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryQamosquitoinspections = append(o.r.HistoryQamosquitoinspections, &organizationRHistoryQamosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryQamosquitoinspections(number int, mods ...HistoryQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryQamosquitoinspectionWithContext(ctx, mods...) + m.AddHistoryQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryQamosquitoinspections(existingModels ...*models.HistoryQamosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryQamosquitoinspections = append(o.r.HistoryQamosquitoinspections, &organizationRHistoryQamosquitoinspectionsR{ + o: o.f.FromExistingHistoryQamosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryQamosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryQamosquitoinspections = nil + }) +} + +func (m organizationMods) WithHistoryRodentlocations(number int, related *HistoryRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryRodentlocations = []*organizationRHistoryRodentlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryRodentlocations(number int, mods ...HistoryRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryRodentlocationWithContext(ctx, mods...) + m.WithHistoryRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryRodentlocations(number int, related *HistoryRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryRodentlocations = append(o.r.HistoryRodentlocations, &organizationRHistoryRodentlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryRodentlocations(number int, mods ...HistoryRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryRodentlocationWithContext(ctx, mods...) + m.AddHistoryRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryRodentlocations(existingModels ...*models.HistoryRodentlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryRodentlocations = append(o.r.HistoryRodentlocations, &organizationRHistoryRodentlocationsR{ + o: o.f.FromExistingHistoryRodentlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryRodentlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryRodentlocations = nil + }) +} + +func (m organizationMods) WithHistorySamplecollections(number int, related *HistorySamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplecollections = []*organizationRHistorySamplecollectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistorySamplecollections(number int, mods ...HistorySamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySamplecollectionWithContext(ctx, mods...) + m.WithHistorySamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistorySamplecollections(number int, related *HistorySamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplecollections = append(o.r.HistorySamplecollections, &organizationRHistorySamplecollectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistorySamplecollections(number int, mods ...HistorySamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySamplecollectionWithContext(ctx, mods...) + m.AddHistorySamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistorySamplecollections(existingModels ...*models.HistorySamplecollection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistorySamplecollections = append(o.r.HistorySamplecollections, &organizationRHistorySamplecollectionsR{ + o: o.f.FromExistingHistorySamplecollection(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistorySamplecollections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplecollections = nil + }) +} + +func (m organizationMods) WithHistorySamplelocations(number int, related *HistorySamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplelocations = []*organizationRHistorySamplelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistorySamplelocations(number int, mods ...HistorySamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySamplelocationWithContext(ctx, mods...) + m.WithHistorySamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistorySamplelocations(number int, related *HistorySamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplelocations = append(o.r.HistorySamplelocations, &organizationRHistorySamplelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistorySamplelocations(number int, mods ...HistorySamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySamplelocationWithContext(ctx, mods...) + m.AddHistorySamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistorySamplelocations(existingModels ...*models.HistorySamplelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistorySamplelocations = append(o.r.HistorySamplelocations, &organizationRHistorySamplelocationsR{ + o: o.f.FromExistingHistorySamplelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistorySamplelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySamplelocations = nil + }) +} + +func (m organizationMods) WithHistoryServicerequests(number int, related *HistoryServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryServicerequests = []*organizationRHistoryServicerequestsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryServicerequests(number int, mods ...HistoryServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryServicerequestWithContext(ctx, mods...) + m.WithHistoryServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryServicerequests(number int, related *HistoryServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryServicerequests = append(o.r.HistoryServicerequests, &organizationRHistoryServicerequestsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryServicerequests(number int, mods ...HistoryServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryServicerequestWithContext(ctx, mods...) + m.AddHistoryServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryServicerequests(existingModels ...*models.HistoryServicerequest) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryServicerequests = append(o.r.HistoryServicerequests, &organizationRHistoryServicerequestsR{ + o: o.f.FromExistingHistoryServicerequest(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryServicerequests() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryServicerequests = nil + }) +} + +func (m organizationMods) WithHistorySpeciesabundances(number int, related *HistorySpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySpeciesabundances = []*organizationRHistorySpeciesabundancesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistorySpeciesabundances(number int, mods ...HistorySpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySpeciesabundanceWithContext(ctx, mods...) + m.WithHistorySpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistorySpeciesabundances(number int, related *HistorySpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySpeciesabundances = append(o.r.HistorySpeciesabundances, &organizationRHistorySpeciesabundancesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistorySpeciesabundances(number int, mods ...HistorySpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistorySpeciesabundanceWithContext(ctx, mods...) + m.AddHistorySpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistorySpeciesabundances(existingModels ...*models.HistorySpeciesabundance) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistorySpeciesabundances = append(o.r.HistorySpeciesabundances, &organizationRHistorySpeciesabundancesR{ + o: o.f.FromExistingHistorySpeciesabundance(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistorySpeciesabundances() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistorySpeciesabundances = nil + }) +} + +func (m organizationMods) WithHistoryStormdrains(number int, related *HistoryStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryStormdrains = []*organizationRHistoryStormdrainsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryStormdrains(number int, mods ...HistoryStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryStormdrainWithContext(ctx, mods...) + m.WithHistoryStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryStormdrains(number int, related *HistoryStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryStormdrains = append(o.r.HistoryStormdrains, &organizationRHistoryStormdrainsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryStormdrains(number int, mods ...HistoryStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryStormdrainWithContext(ctx, mods...) + m.AddHistoryStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryStormdrains(existingModels ...*models.HistoryStormdrain) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryStormdrains = append(o.r.HistoryStormdrains, &organizationRHistoryStormdrainsR{ + o: o.f.FromExistingHistoryStormdrain(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryStormdrains() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryStormdrains = nil + }) +} + +func (m organizationMods) WithHistoryTimecards(number int, related *HistoryTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTimecards = []*organizationRHistoryTimecardsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryTimecards(number int, mods ...HistoryTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTimecardWithContext(ctx, mods...) + m.WithHistoryTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryTimecards(number int, related *HistoryTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTimecards = append(o.r.HistoryTimecards, &organizationRHistoryTimecardsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryTimecards(number int, mods ...HistoryTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTimecardWithContext(ctx, mods...) + m.AddHistoryTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryTimecards(existingModels ...*models.HistoryTimecard) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryTimecards = append(o.r.HistoryTimecards, &organizationRHistoryTimecardsR{ + o: o.f.FromExistingHistoryTimecard(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryTimecards() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTimecards = nil + }) +} + +func (m organizationMods) WithHistoryTrapdata(number int, related *HistoryTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTrapdata = []*organizationRHistoryTrapdataR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryTrapdata(number int, mods ...HistoryTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTrapdatumWithContext(ctx, mods...) + m.WithHistoryTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryTrapdata(number int, related *HistoryTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTrapdata = append(o.r.HistoryTrapdata, &organizationRHistoryTrapdataR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryTrapdata(number int, mods ...HistoryTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTrapdatumWithContext(ctx, mods...) + m.AddHistoryTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryTrapdata(existingModels ...*models.HistoryTrapdatum) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryTrapdata = append(o.r.HistoryTrapdata, &organizationRHistoryTrapdataR{ + o: o.f.FromExistingHistoryTrapdatum(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryTrapdata() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTrapdata = nil + }) +} + +func (m organizationMods) WithHistoryTraplocations(number int, related *HistoryTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTraplocations = []*organizationRHistoryTraplocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryTraplocations(number int, mods ...HistoryTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTraplocationWithContext(ctx, mods...) + m.WithHistoryTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryTraplocations(number int, related *HistoryTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTraplocations = append(o.r.HistoryTraplocations, &organizationRHistoryTraplocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryTraplocations(number int, mods ...HistoryTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTraplocationWithContext(ctx, mods...) + m.AddHistoryTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryTraplocations(existingModels ...*models.HistoryTraplocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryTraplocations = append(o.r.HistoryTraplocations, &organizationRHistoryTraplocationsR{ + o: o.f.FromExistingHistoryTraplocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryTraplocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTraplocations = nil + }) +} + +func (m organizationMods) WithHistoryTreatments(number int, related *HistoryTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatments = []*organizationRHistoryTreatmentsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryTreatments(number int, mods ...HistoryTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTreatmentWithContext(ctx, mods...) + m.WithHistoryTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryTreatments(number int, related *HistoryTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatments = append(o.r.HistoryTreatments, &organizationRHistoryTreatmentsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryTreatments(number int, mods ...HistoryTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTreatmentWithContext(ctx, mods...) + m.AddHistoryTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryTreatments(existingModels ...*models.HistoryTreatment) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryTreatments = append(o.r.HistoryTreatments, &organizationRHistoryTreatmentsR{ + o: o.f.FromExistingHistoryTreatment(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryTreatments() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatments = nil + }) +} + +func (m organizationMods) WithHistoryTreatmentareas(number int, related *HistoryTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatmentareas = []*organizationRHistoryTreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryTreatmentareas(number int, mods ...HistoryTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTreatmentareaWithContext(ctx, mods...) + m.WithHistoryTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryTreatmentareas(number int, related *HistoryTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatmentareas = append(o.r.HistoryTreatmentareas, &organizationRHistoryTreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryTreatmentareas(number int, mods ...HistoryTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryTreatmentareaWithContext(ctx, mods...) + m.AddHistoryTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryTreatmentareas(existingModels ...*models.HistoryTreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryTreatmentareas = append(o.r.HistoryTreatmentareas, &organizationRHistoryTreatmentareasR{ + o: o.f.FromExistingHistoryTreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryTreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryTreatmentareas = nil + }) +} + +func (m organizationMods) WithHistoryZones(number int, related *HistoryZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones = []*organizationRHistoryZonesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryZones(number int, mods ...HistoryZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryZoneWithContext(ctx, mods...) + m.WithHistoryZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryZones(number int, related *HistoryZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones = append(o.r.HistoryZones, &organizationRHistoryZonesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryZones(number int, mods ...HistoryZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryZoneWithContext(ctx, mods...) + m.AddHistoryZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryZones(existingModels ...*models.HistoryZone) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryZones = append(o.r.HistoryZones, &organizationRHistoryZonesR{ + o: o.f.FromExistingHistoryZone(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryZones() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones = nil + }) +} + +func (m organizationMods) WithHistoryZones2s(number int, related *HistoryZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones2s = []*organizationRHistoryZones2sR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHistoryZones2s(number int, mods ...HistoryZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryZones2WithContext(ctx, mods...) + m.WithHistoryZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHistoryZones2s(number int, related *HistoryZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones2s = append(o.r.HistoryZones2s, &organizationRHistoryZones2sR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHistoryZones2s(number int, mods ...HistoryZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewHistoryZones2WithContext(ctx, mods...) + m.AddHistoryZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHistoryZones2s(existingModels ...*models.HistoryZones2) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.HistoryZones2s = append(o.r.HistoryZones2s, &organizationRHistoryZones2sR{ + o: o.f.FromExistingHistoryZones2(em), + }) + } + }) +} + +func (m organizationMods) WithoutHistoryZones2s() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.HistoryZones2s = nil + }) +} + func (m organizationMods) WithUser(number int, related *UserTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { o.r.User = []*organizationRUserR{{ diff --git a/migrations/00007_add_fieldseeker.sql b/migrations/00007_add_fieldseeker.sql index 8c01a8d3..5eca4a1d 100644 --- a/migrations/00007_add_fieldseeker.sql +++ b/migrations/00007_add_fieldseeker.sql @@ -1,5 +1,1063 @@ -- +goose Up +ALTER TABLE organization ADD COLUMN fieldseeker_url TEXT; + CREATE TABLE fs_containerrelate ( + organization_id INTEGER REFERENCES organization(id), + containertype text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + inspsampleid text, + mosquitoinspid text, + objectid integer PRIMARY KEY, + treatmentid text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_fieldscoutinglog ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + objectid integer PRIMARY KEY, + status smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_habitatrelate ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + foreign_id text, + globalid text, + habitattype text, + objectid integer PRIMARY KEY, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_inspectionsample ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + idbytech text, + insp_id text, + objectid integer PRIMARY KEY, + processed smallint, + sampleid text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_inspectionsampledetail ( + organization_id INTEGER REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fadultact text, + fdomstage text, + feggcount smallint, + fieldspecies text, + flarvcount smallint, + flstages text, + fpupcount smallint, + globalid text, + inspsample_id text, + labspecies text, + ldomstage text, + leggcount smallint, + llarvcount smallint, + lpupcount smallint, + objectid integer PRIMARY KEY, + processed smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_linelocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + length_ft double precision, + length_meters double precision, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + shape__length double precision, + usetype text, + waterorigin text, + width_ft double precision, + width_meters double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_locationtracking ( + organization_id INTEGER REFERENCES organization(id), + accuracy double precision, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + objectid integer PRIMARY KEY, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_mosquitoinspection ( + organization_id INTEGER REFERENCES organization(id), + actiontaken text, + activity text, + adultact text, + avetemp double precision, + avglarvae double precision, + avgpupae double precision, + breeding text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + domstage text, + eggs smallint, + enddatetime bigint, + editdate bigint, + editor text, + fieldspecies text, + fieldtech text, + globalid text, + jurisdiction text, + larvaepresent smallint, + linelocid text, + locationname text, + lstages text, + numdips smallint, + objectid integer PRIMARY KEY, + personalcontact smallint, + pointlocid text, + polygonlocid text, + posdips smallint, + positivecontainercount smallint, + pupaepresent smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + tirecount smallint, + totlarvae smallint, + totpupae smallint, + visualmonitoring smallint, + vmcomments text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + adminaction text, + ptaid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_pointlocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + stype text, + symbology text, + usetype text, + waterorigin text, + x double precision, + y double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + assignedtech text, + deactivate_reason text, + scalarpriority bigint, + sourcestatus text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_polygonlocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + filter text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + shape__area double precision, + shape__length double precision, + usetype text, + waterorigin text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_pool ( + organization_id INTEGER REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + lab text, + lab_id text, + objectid integer PRIMARY KEY, + poolyear smallint, + processed smallint, + sampleid text, + survtech text, + testmethod text, + testtech text, + trapdata_id text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + vectorsurvcollectionid text, + vectorsurvpoolid text, + vectorsurvtrapdataid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_pooldetail ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + females smallint, + globalid text, + objectid integer PRIMARY KEY, + pool_id text, + species text, + trapdata_id text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_proposedtreatmentarea ( + organization_id INTEGER REFERENCES organization(id), + acres double precision, + comments text, + completed smallint, + completedby text, + completeddate bigint, + creationdate bigint, + creator text, + duedate bigint, + exported smallint, + editdate bigint, + editor text, + globalid text, + hectares double precision, + issprayroute smallint, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + method text, + name text, + objectid integer PRIMARY KEY, + priority text, + reviewed smallint, + reviewedby text, + revieweddate bigint, + shape__area double precision, + shape__length double precision, + targetapprate double precision, + targetproduct text, + targetspecies text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_qamosquitoinspection ( + organization_id INTEGER REFERENCES organization(id), + acresbreeding double precision, + actiontaken text, + adultactivity smallint, + aquaticorganisms text, + avetemp double precision, + breedingpotential text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + fish smallint, + globalid text, + habvalue1 smallint, + habvalue1percent smallint, + habvalue2 smallint, + habvalue2percent smallint, + larvaeinsidetreatedarea smallint, + larvaeoutsidetreatedarea smallint, + larvaepresent smallint, + larvaereason text, + linelocid text, + locationname text, + lr smallint, + mosquitohabitat text, + movingwater smallint, + negdips smallint, + nowaterever smallint, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + posdips smallint, + potential smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitetype text, + soilconditions text, + sourcereduction text, + startdatetime bigint, + totalacres double precision, + vegetation text, + waterconditions text, + waterduration text, + watermovement1 text, + watermovement1percent smallint, + watermovement2 text, + watermovement2percent smallint, + waterpresent smallint, + watersource text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_rodentlocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + lastinspectaction text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectrodentevidence text, + lastinspectspecies text, + locationname text, + locationnumber bigint, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + jurisdiction text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_samplecollection ( + organization_id INTEGER REFERENCES organization(id), + activity text, + avetemp double precision, + chickenid text, + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + flockid text, + gatewaysync smallint, + globalid text, + lab text, + locationname text, + loc_id text, + objectid integer PRIMARY KEY, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + samplecond text, + samplecount smallint, + sampleid text, + sampletype text, + sex text, + sitecond text, + species text, + startdatetime bigint, + survtech text, + testmethod text, + testtech text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_samplelocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_servicerequest ( + organization_id INTEGER REFERENCES organization(id), + accepted smallint, + acceptedby text, + accepteddate bigint, + allowed text, + assignedtech text, + clraddr1 text, + clraddr2 text, + clranon smallint, + clrcity text, + clrcompany text, + clrcontpref text, + clremail text, + clrfname text, + clrother text, + clrphone1 text, + clrphone2 text, + clrstate text, + clrzip text, + comments text, + creationdate bigint, + creator text, + datetimeclosed bigint, + duedate bigint, + entrytech text, + estcompletedate bigint, + externalerror text, + externalid text, + editdate bigint, + editor text, + firstresponsedate bigint, + globalid text, + issuesreported text, + jurisdiction text, + nextaction text, + notificationtimestamp text, + notified smallint, + notifieddate bigint, + objectid integer PRIMARY KEY, + pointlocid text, + priority text, + recdatetime bigint, + recordstatus smallint, + rejectedby text, + rejecteddate bigint, + rejectedreason text, + reqaddr1 text, + reqaddr2 text, + reqcity text, + reqcompany text, + reqcrossst text, + reqdescr text, + reqfldnotes text, + reqmapgrid text, + reqnotesforcust text, + reqnotesfortech text, + reqpermission smallint, + reqprogramactions text, + reqstate text, + reqsubdiv text, + reqtarget text, + reqzip text, + responsedaycount smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + scheduled smallint, + scheduleddate bigint, + source text, + sr_number bigint, + status text, + supervisor text, + techclosed text, + validx text, + validy text, + xvalue text, + yvalue text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + dog bigint, + spanish bigint, + schedule_notes text, + schedule_period text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_speciesabundance ( + organization_id INTEGER REFERENCES organization(id), + bloodedfem smallint, + creationdate bigint, + creator text, + eggs smallint, + editdate bigint, + editor text, + females bigint, + gravidfem smallint, + globalid text, + larvae smallint, + males smallint, + objectid integer PRIMARY KEY, + poolstogen smallint, + processed smallint, + pupae smallint, + species text, + total bigint, + trapdata_id text, + unknown smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + globalzscore double precision, + h3r7 text, + h3r8 text, + r7score double precision, + r8score double precision, + yearweek bigint, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_stormdrain ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + jurisdiction text, + lastaction text, + laststatus text, + lasttreatdate bigint, + nexttreatmentdate bigint, + objectid integer PRIMARY KEY, + symbology text, + type text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_timecard ( + organization_id INTEGER REFERENCES organization(id), + activity text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + externalid text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + lclocid text, + linelocid text, + locationname text, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + samplelocid text, + srid text, + startdatetime bigint, + traplocid text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + rodentlocid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_trapdata ( + organization_id INTEGER REFERENCES organization(id), + avetemp double precision, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + field bigint, + gatewaysync smallint, + globalid text, + idbytech text, + locationname text, + loc_id text, + lr smallint, + objectid integer PRIMARY KEY, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitecond text, + sortbytech text, + srid text, + startdatetime bigint, + trapactivitytype text, + trapcondition text, + trapnights smallint, + traptype text, + voltage double precision, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + lure text, + vectorsurvtrapdataid text, + vectorsurvtraplocationid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_traplocation ( + organization_id INTEGER REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + route bigint, + route_order bigint, + set_dow bigint, + vectorsurvsiteid text, + h3r7 text, + h3r8 text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_treatment ( + organization_id INTEGER REFERENCES organization(id), + activity text, + areaunit text, + avetemp double precision, + barrierrouteid text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + editdate bigint, + editor text, + fieldtech text, + flowrate double precision, + globalid text, + habitat text, + insp_id text, + invloc text, + linelocid text, + locationname text, + method text, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + product text, + ptaid text, + qty double precision, + qtyunit text, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + targetspecies text, + tirecount smallint, + treatacres double precision, + treatarea double precision, + treathectares double precision, + treatmenthours double precision, + treatmentlength double precision, + treatmentlengthunits text, + totalcostprodcut double precision, + ulvrouteid text, + warningoverride smallint, + winddir text, + windspeed double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + temp_sitecond text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_treatmentarea ( + organization_id INTEGER REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + notified smallint, + objectid integer PRIMARY KEY, + session_id text, + shape__area double precision, + shape__length double precision, + treatdate bigint, + treat_id text, + type text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_zones ( + organization_id INTEGER REFERENCES organization(id), + active bigint, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer PRIMARY KEY, + shape__area double precision, + shape__length double precision, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_zones2 ( + organization_id INTEGER REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer PRIMARY KEY, + shape__area double precision, + shape__length double precision, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE history_containerrelate ( + organization_id INTEGER REFERENCES organization(id), containertype text, creationdate bigint, creator text, @@ -10,16 +1068,20 @@ CREATE TABLE fs_containerrelate ( mosquitoinspid text, objectid integer NOT NULL, treatmentid text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_fieldscoutinglog ( +CREATE TABLE history_fieldscoutinglog ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -27,16 +1089,20 @@ CREATE TABLE fs_fieldscoutinglog ( globalid text, objectid integer NOT NULL, status smallint, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_habitatrelate ( +CREATE TABLE history_habitatrelate ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -45,15 +1111,19 @@ CREATE TABLE fs_habitatrelate ( globalid text, habitattype text, objectid integer NOT NULL, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_inspectionsample ( +CREATE TABLE history_inspectionsample ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -64,15 +1134,19 @@ CREATE TABLE fs_inspectionsample ( objectid integer NOT NULL, processed smallint, sampleid text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_inspectionsampledetail ( +CREATE TABLE history_inspectionsampledetail ( + organization_id INTEGER REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -94,15 +1168,19 @@ CREATE TABLE fs_inspectionsampledetail ( lpupcount smallint, objectid integer NOT NULL, processed smallint, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_linelocation ( +CREATE TABLE history_linelocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -147,16 +1225,20 @@ CREATE TABLE fs_linelocation ( width_meters double precision, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_locationtracking ( +CREATE TABLE history_locationtracking ( + organization_id INTEGER REFERENCES organization(id), accuracy double precision, creationdate bigint, creator text, @@ -165,16 +1247,20 @@ CREATE TABLE fs_locationtracking ( fieldtech text, globalid text, objectid integer NOT NULL, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_mosquitoinspection ( +CREATE TABLE history_mosquitoinspection ( + organization_id INTEGER REFERENCES organization(id), actiontaken text, activity text, adultact text, @@ -226,6 +1312,7 @@ CREATE TABLE fs_mosquitoinspection ( windspeed double precision, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -233,11 +1320,14 @@ CREATE TABLE fs_mosquitoinspection ( last_edited_date bigint, last_edited_user text, adminaction text, - ptaid text + ptaid text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_pointlocation ( +CREATE TABLE history_pointlocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -283,11 +1373,14 @@ CREATE TABLE fs_pointlocation ( assignedtech text, deactivate_reason text, scalarpriority bigint, - sourcestatus text + sourcestatus text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_polygonlocation ( +CREATE TABLE history_polygonlocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -331,11 +1424,14 @@ CREATE TABLE fs_polygonlocation ( zone text, zone2 text, geometry_x double precision, - geometry_y double precision + geometry_y double precision, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_pool ( +CREATE TABLE history_pool ( + organization_id INTEGER REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -357,6 +1453,7 @@ CREATE TABLE fs_pool ( testmethod text, testtech text, trapdata_id text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -365,10 +1462,13 @@ CREATE TABLE fs_pool ( last_edited_user text, vectorsurvcollectionid text, vectorsurvpoolid text, - vectorsurvtrapdataid text + vectorsurvtrapdataid text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_pooldetail ( +CREATE TABLE history_pooldetail ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -379,15 +1479,19 @@ CREATE TABLE fs_pooldetail ( pool_id text, species text, trapdata_id text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_proposedtreatmentarea ( +CREATE TABLE history_proposedtreatmentarea ( + organization_id INTEGER REFERENCES organization(id), acres double precision, comments text, completed smallint, @@ -422,10 +1526,13 @@ CREATE TABLE fs_proposedtreatmentarea ( zone text, zone2 text, geometry_x double precision, - geometry_y double precision + geometry_y double precision, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_qamosquitoinspection ( +CREATE TABLE history_qamosquitoinspection ( + organization_id INTEGER REFERENCES organization(id), acresbreeding double precision, actiontaken text, adultactivity smallint, @@ -484,15 +1591,19 @@ CREATE TABLE fs_qamosquitoinspection ( windspeed double precision, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_rodentlocation ( +CREATE TABLE history_rodentlocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -518,16 +1629,20 @@ CREATE TABLE fs_rodentlocation ( usetype text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, last_edited_user text, - jurisdiction text + jurisdiction text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_samplecollection ( +CREATE TABLE history_samplecollection ( + organization_id INTEGER REFERENCES organization(id), activity text, avetemp double precision, chickenid text, @@ -570,15 +1685,19 @@ CREATE TABLE fs_samplecollection ( windspeed double precision, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_samplelocation ( +CREATE TABLE history_samplelocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -599,16 +1718,20 @@ CREATE TABLE fs_samplelocation ( usetype text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_servicerequest ( +CREATE TABLE history_servicerequest ( + organization_id INTEGER REFERENCES organization(id), accepted smallint, acceptedby text, accepteddate bigint, @@ -687,6 +1810,7 @@ CREATE TABLE fs_servicerequest ( yvalue text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -696,11 +1820,14 @@ CREATE TABLE fs_servicerequest ( dog bigint, spanish bigint, schedule_notes text, - schedule_period text + schedule_period text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_speciesabundance ( +CREATE TABLE history_speciesabundance ( + organization_id INTEGER REFERENCES organization(id), bloodedfem smallint, creationdate bigint, creator text, @@ -720,6 +1847,7 @@ CREATE TABLE fs_speciesabundance ( total bigint, trapdata_id text, unknown smallint, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -731,11 +1859,14 @@ CREATE TABLE fs_speciesabundance ( h3r8 text, r7score double precision, r8score double precision, - yearweek bigint + yearweek bigint, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_stormdrain ( +CREATE TABLE history_stormdrain ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -751,16 +1882,20 @@ CREATE TABLE fs_stormdrain ( type text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_timecard ( +CREATE TABLE history_timecard ( + organization_id INTEGER REFERENCES organization(id), activity text, comments text, creationdate bigint, @@ -784,17 +1919,21 @@ CREATE TABLE fs_timecard ( traplocid text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, last_edited_user text, - rodentlocid text + rodentlocid text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_trapdata ( +CREATE TABLE history_trapdata ( + organization_id INTEGER REFERENCES organization(id), avetemp double precision, comments text, creationdate bigint, @@ -830,6 +1969,7 @@ CREATE TABLE fs_trapdata ( windspeed double precision, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -838,11 +1978,14 @@ CREATE TABLE fs_trapdata ( last_edited_user text, lure text, vectorsurvtrapdataid text, - vectorsurvtraplocationid text + vectorsurvtraplocationid text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_traplocation ( +CREATE TABLE history_traplocation ( + organization_id INTEGER REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -863,6 +2006,7 @@ CREATE TABLE fs_traplocation ( usetype text, zone text, zone2 text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, @@ -874,11 +2018,14 @@ CREATE TABLE fs_traplocation ( set_dow bigint, vectorsurvsiteid text, h3r7 text, - h3r8 text + h3r8 text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_treatment ( +CREATE TABLE history_treatment ( + organization_id INTEGER REFERENCES organization(id), activity text, areaunit text, avetemp double precision, @@ -934,11 +2081,14 @@ CREATE TABLE fs_treatment ( zone2 text, geometry_x double precision, geometry_y double precision, - temp_sitecond text + temp_sitecond text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_treatmentarea ( +CREATE TABLE history_treatmentarea ( + organization_id INTEGER REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -953,16 +2103,20 @@ CREATE TABLE fs_treatmentarea ( treatdate bigint, treat_id text, type text, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_zones ( +CREATE TABLE history_zones ( + organization_id INTEGER REFERENCES organization(id), active bigint, creationdate bigint, creator text, @@ -973,16 +2127,20 @@ CREATE TABLE fs_zones ( objectid integer NOT NULL, shape__area double precision, shape__length double precision, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -CREATE TABLE fs_zones2 ( +CREATE TABLE history_zones2 ( + organization_id INTEGER REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -992,12 +2150,15 @@ CREATE TABLE fs_zones2 ( objectid integer NOT NULL, shape__area double precision, shape__length double precision, + created TIMESTAMP, created_date bigint, created_user text, geometry_x double precision, geometry_y double precision, last_edited_date bigint, - last_edited_user text + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) ); -- +goose Down @@ -1028,3 +2189,31 @@ DROP TABLE fs_treatment; DROP TABLE fs_treatmentarea; DROP TABLE fs_zones; DROP TABLE fs_zones2; +DROP TABLE history_containerrelate; +DROP TABLE history_fieldscoutinglog; +DROP TABLE history_habitatrelate; +DROP TABLE history_inspectionsample; +DROP TABLE history_inspectionsampledetail; +DROP TABLE history_linelocation; +DROP TABLE history_locationtracking; +DROP TABLE history_mosquitoinspection; +DROP TABLE history_pointlocation; +DROP TABLE history_polygonlocation; +DROP TABLE history_pool; +DROP TABLE history_pooldetail; +DROP TABLE history_proposedtreatmentarea; +DROP TABLE history_qamosquitoinspection; +DROP TABLE history_rodentlocation; +DROP TABLE history_samplecollection; +DROP TABLE history_samplelocation; +DROP TABLE history_servicerequest; +DROP TABLE history_speciesabundance; +DROP TABLE history_stormdrain; +DROP TABLE history_timecard; +DROP TABLE history_trapdata; +DROP TABLE history_traplocation; +DROP TABLE history_treatment; +DROP TABLE history_treatmentarea; +DROP TABLE history_zones; +DROP TABLE history_zones2; +ALTER TABLE organization DROP COLUMN fieldseeker_url; diff --git a/models/bob_joins.bob.go b/models/bob_joins.bob.go index f947bebe..449bbf74 100644 --- a/models/bob_joins.bob.go +++ b/models/bob_joins.bob.go @@ -32,9 +32,63 @@ func (j joinSet[Q]) AliasedAs(alias string) joinSet[Q] { } type joins[Q dialect.Joinable] struct { - OauthTokens joinSet[oauthTokenJoins[Q]] - Organizations joinSet[organizationJoins[Q]] - Users joinSet[userJoins[Q]] + FSContainerrelates joinSet[fsContainerrelateJoins[Q]] + FSFieldscoutinglogs joinSet[fsFieldscoutinglogJoins[Q]] + FSHabitatrelates joinSet[fsHabitatrelateJoins[Q]] + FSInspectionsamples joinSet[fsInspectionsampleJoins[Q]] + FSInspectionsampledetails joinSet[fsInspectionsampledetailJoins[Q]] + FSLinelocations joinSet[fsLinelocationJoins[Q]] + FSLocationtrackings joinSet[fsLocationtrackingJoins[Q]] + FSMosquitoinspections joinSet[fsMosquitoinspectionJoins[Q]] + FSPointlocations joinSet[fsPointlocationJoins[Q]] + FSPolygonlocations joinSet[fsPolygonlocationJoins[Q]] + FSPools joinSet[fsPoolJoins[Q]] + FSPooldetails joinSet[fsPooldetailJoins[Q]] + FSProposedtreatmentareas joinSet[fsProposedtreatmentareaJoins[Q]] + FSQamosquitoinspections joinSet[fsQamosquitoinspectionJoins[Q]] + FSRodentlocations joinSet[fsRodentlocationJoins[Q]] + FSSamplecollections joinSet[fsSamplecollectionJoins[Q]] + FSSamplelocations joinSet[fsSamplelocationJoins[Q]] + FSServicerequests joinSet[fsServicerequestJoins[Q]] + FSSpeciesabundances joinSet[fsSpeciesabundanceJoins[Q]] + FSStormdrains joinSet[fsStormdrainJoins[Q]] + FSTimecards joinSet[fsTimecardJoins[Q]] + FSTrapdata joinSet[fsTrapdatumJoins[Q]] + FSTraplocations joinSet[fsTraplocationJoins[Q]] + FSTreatments joinSet[fsTreatmentJoins[Q]] + FSTreatmentareas joinSet[fsTreatmentareaJoins[Q]] + FSZones joinSet[fsZoneJoins[Q]] + FSZones2s joinSet[fsZones2Joins[Q]] + HistoryContainerrelates joinSet[historyContainerrelateJoins[Q]] + HistoryFieldscoutinglogs joinSet[historyFieldscoutinglogJoins[Q]] + HistoryHabitatrelates joinSet[historyHabitatrelateJoins[Q]] + HistoryInspectionsamples joinSet[historyInspectionsampleJoins[Q]] + HistoryInspectionsampledetails joinSet[historyInspectionsampledetailJoins[Q]] + HistoryLinelocations joinSet[historyLinelocationJoins[Q]] + HistoryLocationtrackings joinSet[historyLocationtrackingJoins[Q]] + HistoryMosquitoinspections joinSet[historyMosquitoinspectionJoins[Q]] + HistoryPointlocations joinSet[historyPointlocationJoins[Q]] + HistoryPolygonlocations joinSet[historyPolygonlocationJoins[Q]] + HistoryPools joinSet[historyPoolJoins[Q]] + HistoryPooldetails joinSet[historyPooldetailJoins[Q]] + HistoryProposedtreatmentareas joinSet[historyProposedtreatmentareaJoins[Q]] + HistoryQamosquitoinspections joinSet[historyQamosquitoinspectionJoins[Q]] + HistoryRodentlocations joinSet[historyRodentlocationJoins[Q]] + HistorySamplecollections joinSet[historySamplecollectionJoins[Q]] + HistorySamplelocations joinSet[historySamplelocationJoins[Q]] + HistoryServicerequests joinSet[historyServicerequestJoins[Q]] + HistorySpeciesabundances joinSet[historySpeciesabundanceJoins[Q]] + HistoryStormdrains joinSet[historyStormdrainJoins[Q]] + HistoryTimecards joinSet[historyTimecardJoins[Q]] + HistoryTrapdata joinSet[historyTrapdatumJoins[Q]] + HistoryTraplocations joinSet[historyTraplocationJoins[Q]] + HistoryTreatments joinSet[historyTreatmentJoins[Q]] + HistoryTreatmentareas joinSet[historyTreatmentareaJoins[Q]] + HistoryZones joinSet[historyZoneJoins[Q]] + HistoryZones2s joinSet[historyZones2Joins[Q]] + OauthTokens joinSet[oauthTokenJoins[Q]] + Organizations joinSet[organizationJoins[Q]] + Users joinSet[userJoins[Q]] } func buildJoinSet[Q interface{ aliasedAs(string) Q }, C any, F func(C, string) Q](c C, f F) joinSet[Q] { @@ -47,9 +101,63 @@ func buildJoinSet[Q interface{ aliasedAs(string) Q }, C any, F func(C, string) Q func getJoins[Q dialect.Joinable]() joins[Q] { return joins[Q]{ - OauthTokens: buildJoinSet[oauthTokenJoins[Q]](OauthTokens.Columns, buildOauthTokenJoins), - Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins), - Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins), + FSContainerrelates: buildJoinSet[fsContainerrelateJoins[Q]](FSContainerrelates.Columns, buildFSContainerrelateJoins), + FSFieldscoutinglogs: buildJoinSet[fsFieldscoutinglogJoins[Q]](FSFieldscoutinglogs.Columns, buildFSFieldscoutinglogJoins), + FSHabitatrelates: buildJoinSet[fsHabitatrelateJoins[Q]](FSHabitatrelates.Columns, buildFSHabitatrelateJoins), + FSInspectionsamples: buildJoinSet[fsInspectionsampleJoins[Q]](FSInspectionsamples.Columns, buildFSInspectionsampleJoins), + FSInspectionsampledetails: buildJoinSet[fsInspectionsampledetailJoins[Q]](FSInspectionsampledetails.Columns, buildFSInspectionsampledetailJoins), + FSLinelocations: buildJoinSet[fsLinelocationJoins[Q]](FSLinelocations.Columns, buildFSLinelocationJoins), + FSLocationtrackings: buildJoinSet[fsLocationtrackingJoins[Q]](FSLocationtrackings.Columns, buildFSLocationtrackingJoins), + FSMosquitoinspections: buildJoinSet[fsMosquitoinspectionJoins[Q]](FSMosquitoinspections.Columns, buildFSMosquitoinspectionJoins), + FSPointlocations: buildJoinSet[fsPointlocationJoins[Q]](FSPointlocations.Columns, buildFSPointlocationJoins), + FSPolygonlocations: buildJoinSet[fsPolygonlocationJoins[Q]](FSPolygonlocations.Columns, buildFSPolygonlocationJoins), + FSPools: buildJoinSet[fsPoolJoins[Q]](FSPools.Columns, buildFSPoolJoins), + FSPooldetails: buildJoinSet[fsPooldetailJoins[Q]](FSPooldetails.Columns, buildFSPooldetailJoins), + FSProposedtreatmentareas: buildJoinSet[fsProposedtreatmentareaJoins[Q]](FSProposedtreatmentareas.Columns, buildFSProposedtreatmentareaJoins), + FSQamosquitoinspections: buildJoinSet[fsQamosquitoinspectionJoins[Q]](FSQamosquitoinspections.Columns, buildFSQamosquitoinspectionJoins), + FSRodentlocations: buildJoinSet[fsRodentlocationJoins[Q]](FSRodentlocations.Columns, buildFSRodentlocationJoins), + FSSamplecollections: buildJoinSet[fsSamplecollectionJoins[Q]](FSSamplecollections.Columns, buildFSSamplecollectionJoins), + FSSamplelocations: buildJoinSet[fsSamplelocationJoins[Q]](FSSamplelocations.Columns, buildFSSamplelocationJoins), + FSServicerequests: buildJoinSet[fsServicerequestJoins[Q]](FSServicerequests.Columns, buildFSServicerequestJoins), + FSSpeciesabundances: buildJoinSet[fsSpeciesabundanceJoins[Q]](FSSpeciesabundances.Columns, buildFSSpeciesabundanceJoins), + FSStormdrains: buildJoinSet[fsStormdrainJoins[Q]](FSStormdrains.Columns, buildFSStormdrainJoins), + FSTimecards: buildJoinSet[fsTimecardJoins[Q]](FSTimecards.Columns, buildFSTimecardJoins), + FSTrapdata: buildJoinSet[fsTrapdatumJoins[Q]](FSTrapdata.Columns, buildFSTrapdatumJoins), + FSTraplocations: buildJoinSet[fsTraplocationJoins[Q]](FSTraplocations.Columns, buildFSTraplocationJoins), + FSTreatments: buildJoinSet[fsTreatmentJoins[Q]](FSTreatments.Columns, buildFSTreatmentJoins), + FSTreatmentareas: buildJoinSet[fsTreatmentareaJoins[Q]](FSTreatmentareas.Columns, buildFSTreatmentareaJoins), + FSZones: buildJoinSet[fsZoneJoins[Q]](FSZones.Columns, buildFSZoneJoins), + FSZones2s: buildJoinSet[fsZones2Joins[Q]](FSZones2s.Columns, buildFSZones2Joins), + HistoryContainerrelates: buildJoinSet[historyContainerrelateJoins[Q]](HistoryContainerrelates.Columns, buildHistoryContainerrelateJoins), + HistoryFieldscoutinglogs: buildJoinSet[historyFieldscoutinglogJoins[Q]](HistoryFieldscoutinglogs.Columns, buildHistoryFieldscoutinglogJoins), + HistoryHabitatrelates: buildJoinSet[historyHabitatrelateJoins[Q]](HistoryHabitatrelates.Columns, buildHistoryHabitatrelateJoins), + HistoryInspectionsamples: buildJoinSet[historyInspectionsampleJoins[Q]](HistoryInspectionsamples.Columns, buildHistoryInspectionsampleJoins), + HistoryInspectionsampledetails: buildJoinSet[historyInspectionsampledetailJoins[Q]](HistoryInspectionsampledetails.Columns, buildHistoryInspectionsampledetailJoins), + HistoryLinelocations: buildJoinSet[historyLinelocationJoins[Q]](HistoryLinelocations.Columns, buildHistoryLinelocationJoins), + HistoryLocationtrackings: buildJoinSet[historyLocationtrackingJoins[Q]](HistoryLocationtrackings.Columns, buildHistoryLocationtrackingJoins), + HistoryMosquitoinspections: buildJoinSet[historyMosquitoinspectionJoins[Q]](HistoryMosquitoinspections.Columns, buildHistoryMosquitoinspectionJoins), + HistoryPointlocations: buildJoinSet[historyPointlocationJoins[Q]](HistoryPointlocations.Columns, buildHistoryPointlocationJoins), + HistoryPolygonlocations: buildJoinSet[historyPolygonlocationJoins[Q]](HistoryPolygonlocations.Columns, buildHistoryPolygonlocationJoins), + HistoryPools: buildJoinSet[historyPoolJoins[Q]](HistoryPools.Columns, buildHistoryPoolJoins), + HistoryPooldetails: buildJoinSet[historyPooldetailJoins[Q]](HistoryPooldetails.Columns, buildHistoryPooldetailJoins), + HistoryProposedtreatmentareas: buildJoinSet[historyProposedtreatmentareaJoins[Q]](HistoryProposedtreatmentareas.Columns, buildHistoryProposedtreatmentareaJoins), + HistoryQamosquitoinspections: buildJoinSet[historyQamosquitoinspectionJoins[Q]](HistoryQamosquitoinspections.Columns, buildHistoryQamosquitoinspectionJoins), + HistoryRodentlocations: buildJoinSet[historyRodentlocationJoins[Q]](HistoryRodentlocations.Columns, buildHistoryRodentlocationJoins), + HistorySamplecollections: buildJoinSet[historySamplecollectionJoins[Q]](HistorySamplecollections.Columns, buildHistorySamplecollectionJoins), + HistorySamplelocations: buildJoinSet[historySamplelocationJoins[Q]](HistorySamplelocations.Columns, buildHistorySamplelocationJoins), + HistoryServicerequests: buildJoinSet[historyServicerequestJoins[Q]](HistoryServicerequests.Columns, buildHistoryServicerequestJoins), + HistorySpeciesabundances: buildJoinSet[historySpeciesabundanceJoins[Q]](HistorySpeciesabundances.Columns, buildHistorySpeciesabundanceJoins), + HistoryStormdrains: buildJoinSet[historyStormdrainJoins[Q]](HistoryStormdrains.Columns, buildHistoryStormdrainJoins), + HistoryTimecards: buildJoinSet[historyTimecardJoins[Q]](HistoryTimecards.Columns, buildHistoryTimecardJoins), + HistoryTrapdata: buildJoinSet[historyTrapdatumJoins[Q]](HistoryTrapdata.Columns, buildHistoryTrapdatumJoins), + HistoryTraplocations: buildJoinSet[historyTraplocationJoins[Q]](HistoryTraplocations.Columns, buildHistoryTraplocationJoins), + HistoryTreatments: buildJoinSet[historyTreatmentJoins[Q]](HistoryTreatments.Columns, buildHistoryTreatmentJoins), + HistoryTreatmentareas: buildJoinSet[historyTreatmentareaJoins[Q]](HistoryTreatmentareas.Columns, buildHistoryTreatmentareaJoins), + HistoryZones: buildJoinSet[historyZoneJoins[Q]](HistoryZones.Columns, buildHistoryZoneJoins), + HistoryZones2s: buildJoinSet[historyZones2Joins[Q]](HistoryZones2s.Columns, buildHistoryZones2Joins), + OauthTokens: buildJoinSet[oauthTokenJoins[Q]](OauthTokens.Columns, buildOauthTokenJoins), + Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins), + Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins), } } diff --git a/models/bob_loaders.bob.go b/models/bob_loaders.bob.go index 8d4df060..2888ff0c 100644 --- a/models/bob_loaders.bob.go +++ b/models/bob_loaders.bob.go @@ -17,16 +17,124 @@ import ( var Preload = getPreloaders() type preloaders struct { - OauthToken oauthTokenPreloader - Organization organizationPreloader - User userPreloader + FSContainerrelate fsContainerrelatePreloader + FSFieldscoutinglog fsFieldscoutinglogPreloader + FSHabitatrelate fsHabitatrelatePreloader + FSInspectionsample fsInspectionsamplePreloader + FSInspectionsampledetail fsInspectionsampledetailPreloader + FSLinelocation fsLinelocationPreloader + FSLocationtracking fsLocationtrackingPreloader + FSMosquitoinspection fsMosquitoinspectionPreloader + FSPointlocation fsPointlocationPreloader + FSPolygonlocation fsPolygonlocationPreloader + FSPool fsPoolPreloader + FSPooldetail fsPooldetailPreloader + FSProposedtreatmentarea fsProposedtreatmentareaPreloader + FSQamosquitoinspection fsQamosquitoinspectionPreloader + FSRodentlocation fsRodentlocationPreloader + FSSamplecollection fsSamplecollectionPreloader + FSSamplelocation fsSamplelocationPreloader + FSServicerequest fsServicerequestPreloader + FSSpeciesabundance fsSpeciesabundancePreloader + FSStormdrain fsStormdrainPreloader + FSTimecard fsTimecardPreloader + FSTrapdatum fsTrapdatumPreloader + FSTraplocation fsTraplocationPreloader + FSTreatment fsTreatmentPreloader + FSTreatmentarea fsTreatmentareaPreloader + FSZone fsZonePreloader + FSZones2 fsZones2Preloader + HistoryContainerrelate historyContainerrelatePreloader + HistoryFieldscoutinglog historyFieldscoutinglogPreloader + HistoryHabitatrelate historyHabitatrelatePreloader + HistoryInspectionsample historyInspectionsamplePreloader + HistoryInspectionsampledetail historyInspectionsampledetailPreloader + HistoryLinelocation historyLinelocationPreloader + HistoryLocationtracking historyLocationtrackingPreloader + HistoryMosquitoinspection historyMosquitoinspectionPreloader + HistoryPointlocation historyPointlocationPreloader + HistoryPolygonlocation historyPolygonlocationPreloader + HistoryPool historyPoolPreloader + HistoryPooldetail historyPooldetailPreloader + HistoryProposedtreatmentarea historyProposedtreatmentareaPreloader + HistoryQamosquitoinspection historyQamosquitoinspectionPreloader + HistoryRodentlocation historyRodentlocationPreloader + HistorySamplecollection historySamplecollectionPreloader + HistorySamplelocation historySamplelocationPreloader + HistoryServicerequest historyServicerequestPreloader + HistorySpeciesabundance historySpeciesabundancePreloader + HistoryStormdrain historyStormdrainPreloader + HistoryTimecard historyTimecardPreloader + HistoryTrapdatum historyTrapdatumPreloader + HistoryTraplocation historyTraplocationPreloader + HistoryTreatment historyTreatmentPreloader + HistoryTreatmentarea historyTreatmentareaPreloader + HistoryZone historyZonePreloader + HistoryZones2 historyZones2Preloader + OauthToken oauthTokenPreloader + Organization organizationPreloader + User userPreloader } func getPreloaders() preloaders { return preloaders{ - OauthToken: buildOauthTokenPreloader(), - Organization: buildOrganizationPreloader(), - User: buildUserPreloader(), + FSContainerrelate: buildFSContainerrelatePreloader(), + FSFieldscoutinglog: buildFSFieldscoutinglogPreloader(), + FSHabitatrelate: buildFSHabitatrelatePreloader(), + FSInspectionsample: buildFSInspectionsamplePreloader(), + FSInspectionsampledetail: buildFSInspectionsampledetailPreloader(), + FSLinelocation: buildFSLinelocationPreloader(), + FSLocationtracking: buildFSLocationtrackingPreloader(), + FSMosquitoinspection: buildFSMosquitoinspectionPreloader(), + FSPointlocation: buildFSPointlocationPreloader(), + FSPolygonlocation: buildFSPolygonlocationPreloader(), + FSPool: buildFSPoolPreloader(), + FSPooldetail: buildFSPooldetailPreloader(), + FSProposedtreatmentarea: buildFSProposedtreatmentareaPreloader(), + FSQamosquitoinspection: buildFSQamosquitoinspectionPreloader(), + FSRodentlocation: buildFSRodentlocationPreloader(), + FSSamplecollection: buildFSSamplecollectionPreloader(), + FSSamplelocation: buildFSSamplelocationPreloader(), + FSServicerequest: buildFSServicerequestPreloader(), + FSSpeciesabundance: buildFSSpeciesabundancePreloader(), + FSStormdrain: buildFSStormdrainPreloader(), + FSTimecard: buildFSTimecardPreloader(), + FSTrapdatum: buildFSTrapdatumPreloader(), + FSTraplocation: buildFSTraplocationPreloader(), + FSTreatment: buildFSTreatmentPreloader(), + FSTreatmentarea: buildFSTreatmentareaPreloader(), + FSZone: buildFSZonePreloader(), + FSZones2: buildFSZones2Preloader(), + HistoryContainerrelate: buildHistoryContainerrelatePreloader(), + HistoryFieldscoutinglog: buildHistoryFieldscoutinglogPreloader(), + HistoryHabitatrelate: buildHistoryHabitatrelatePreloader(), + HistoryInspectionsample: buildHistoryInspectionsamplePreloader(), + HistoryInspectionsampledetail: buildHistoryInspectionsampledetailPreloader(), + HistoryLinelocation: buildHistoryLinelocationPreloader(), + HistoryLocationtracking: buildHistoryLocationtrackingPreloader(), + HistoryMosquitoinspection: buildHistoryMosquitoinspectionPreloader(), + HistoryPointlocation: buildHistoryPointlocationPreloader(), + HistoryPolygonlocation: buildHistoryPolygonlocationPreloader(), + HistoryPool: buildHistoryPoolPreloader(), + HistoryPooldetail: buildHistoryPooldetailPreloader(), + HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaPreloader(), + HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionPreloader(), + HistoryRodentlocation: buildHistoryRodentlocationPreloader(), + HistorySamplecollection: buildHistorySamplecollectionPreloader(), + HistorySamplelocation: buildHistorySamplelocationPreloader(), + HistoryServicerequest: buildHistoryServicerequestPreloader(), + HistorySpeciesabundance: buildHistorySpeciesabundancePreloader(), + HistoryStormdrain: buildHistoryStormdrainPreloader(), + HistoryTimecard: buildHistoryTimecardPreloader(), + HistoryTrapdatum: buildHistoryTrapdatumPreloader(), + HistoryTraplocation: buildHistoryTraplocationPreloader(), + HistoryTreatment: buildHistoryTreatmentPreloader(), + HistoryTreatmentarea: buildHistoryTreatmentareaPreloader(), + HistoryZone: buildHistoryZonePreloader(), + HistoryZones2: buildHistoryZones2Preloader(), + OauthToken: buildOauthTokenPreloader(), + Organization: buildOrganizationPreloader(), + User: buildUserPreloader(), } } @@ -37,16 +145,124 @@ var ( ) type thenLoaders[Q orm.Loadable] struct { - OauthToken oauthTokenThenLoader[Q] - Organization organizationThenLoader[Q] - User userThenLoader[Q] + FSContainerrelate fsContainerrelateThenLoader[Q] + FSFieldscoutinglog fsFieldscoutinglogThenLoader[Q] + FSHabitatrelate fsHabitatrelateThenLoader[Q] + FSInspectionsample fsInspectionsampleThenLoader[Q] + FSInspectionsampledetail fsInspectionsampledetailThenLoader[Q] + FSLinelocation fsLinelocationThenLoader[Q] + FSLocationtracking fsLocationtrackingThenLoader[Q] + FSMosquitoinspection fsMosquitoinspectionThenLoader[Q] + FSPointlocation fsPointlocationThenLoader[Q] + FSPolygonlocation fsPolygonlocationThenLoader[Q] + FSPool fsPoolThenLoader[Q] + FSPooldetail fsPooldetailThenLoader[Q] + FSProposedtreatmentarea fsProposedtreatmentareaThenLoader[Q] + FSQamosquitoinspection fsQamosquitoinspectionThenLoader[Q] + FSRodentlocation fsRodentlocationThenLoader[Q] + FSSamplecollection fsSamplecollectionThenLoader[Q] + FSSamplelocation fsSamplelocationThenLoader[Q] + FSServicerequest fsServicerequestThenLoader[Q] + FSSpeciesabundance fsSpeciesabundanceThenLoader[Q] + FSStormdrain fsStormdrainThenLoader[Q] + FSTimecard fsTimecardThenLoader[Q] + FSTrapdatum fsTrapdatumThenLoader[Q] + FSTraplocation fsTraplocationThenLoader[Q] + FSTreatment fsTreatmentThenLoader[Q] + FSTreatmentarea fsTreatmentareaThenLoader[Q] + FSZone fsZoneThenLoader[Q] + FSZones2 fsZones2ThenLoader[Q] + HistoryContainerrelate historyContainerrelateThenLoader[Q] + HistoryFieldscoutinglog historyFieldscoutinglogThenLoader[Q] + HistoryHabitatrelate historyHabitatrelateThenLoader[Q] + HistoryInspectionsample historyInspectionsampleThenLoader[Q] + HistoryInspectionsampledetail historyInspectionsampledetailThenLoader[Q] + HistoryLinelocation historyLinelocationThenLoader[Q] + HistoryLocationtracking historyLocationtrackingThenLoader[Q] + HistoryMosquitoinspection historyMosquitoinspectionThenLoader[Q] + HistoryPointlocation historyPointlocationThenLoader[Q] + HistoryPolygonlocation historyPolygonlocationThenLoader[Q] + HistoryPool historyPoolThenLoader[Q] + HistoryPooldetail historyPooldetailThenLoader[Q] + HistoryProposedtreatmentarea historyProposedtreatmentareaThenLoader[Q] + HistoryQamosquitoinspection historyQamosquitoinspectionThenLoader[Q] + HistoryRodentlocation historyRodentlocationThenLoader[Q] + HistorySamplecollection historySamplecollectionThenLoader[Q] + HistorySamplelocation historySamplelocationThenLoader[Q] + HistoryServicerequest historyServicerequestThenLoader[Q] + HistorySpeciesabundance historySpeciesabundanceThenLoader[Q] + HistoryStormdrain historyStormdrainThenLoader[Q] + HistoryTimecard historyTimecardThenLoader[Q] + HistoryTrapdatum historyTrapdatumThenLoader[Q] + HistoryTraplocation historyTraplocationThenLoader[Q] + HistoryTreatment historyTreatmentThenLoader[Q] + HistoryTreatmentarea historyTreatmentareaThenLoader[Q] + HistoryZone historyZoneThenLoader[Q] + HistoryZones2 historyZones2ThenLoader[Q] + OauthToken oauthTokenThenLoader[Q] + Organization organizationThenLoader[Q] + User userThenLoader[Q] } func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { return thenLoaders[Q]{ - OauthToken: buildOauthTokenThenLoader[Q](), - Organization: buildOrganizationThenLoader[Q](), - User: buildUserThenLoader[Q](), + FSContainerrelate: buildFSContainerrelateThenLoader[Q](), + FSFieldscoutinglog: buildFSFieldscoutinglogThenLoader[Q](), + FSHabitatrelate: buildFSHabitatrelateThenLoader[Q](), + FSInspectionsample: buildFSInspectionsampleThenLoader[Q](), + FSInspectionsampledetail: buildFSInspectionsampledetailThenLoader[Q](), + FSLinelocation: buildFSLinelocationThenLoader[Q](), + FSLocationtracking: buildFSLocationtrackingThenLoader[Q](), + FSMosquitoinspection: buildFSMosquitoinspectionThenLoader[Q](), + FSPointlocation: buildFSPointlocationThenLoader[Q](), + FSPolygonlocation: buildFSPolygonlocationThenLoader[Q](), + FSPool: buildFSPoolThenLoader[Q](), + FSPooldetail: buildFSPooldetailThenLoader[Q](), + FSProposedtreatmentarea: buildFSProposedtreatmentareaThenLoader[Q](), + FSQamosquitoinspection: buildFSQamosquitoinspectionThenLoader[Q](), + FSRodentlocation: buildFSRodentlocationThenLoader[Q](), + FSSamplecollection: buildFSSamplecollectionThenLoader[Q](), + FSSamplelocation: buildFSSamplelocationThenLoader[Q](), + FSServicerequest: buildFSServicerequestThenLoader[Q](), + FSSpeciesabundance: buildFSSpeciesabundanceThenLoader[Q](), + FSStormdrain: buildFSStormdrainThenLoader[Q](), + FSTimecard: buildFSTimecardThenLoader[Q](), + FSTrapdatum: buildFSTrapdatumThenLoader[Q](), + FSTraplocation: buildFSTraplocationThenLoader[Q](), + FSTreatment: buildFSTreatmentThenLoader[Q](), + FSTreatmentarea: buildFSTreatmentareaThenLoader[Q](), + FSZone: buildFSZoneThenLoader[Q](), + FSZones2: buildFSZones2ThenLoader[Q](), + HistoryContainerrelate: buildHistoryContainerrelateThenLoader[Q](), + HistoryFieldscoutinglog: buildHistoryFieldscoutinglogThenLoader[Q](), + HistoryHabitatrelate: buildHistoryHabitatrelateThenLoader[Q](), + HistoryInspectionsample: buildHistoryInspectionsampleThenLoader[Q](), + HistoryInspectionsampledetail: buildHistoryInspectionsampledetailThenLoader[Q](), + HistoryLinelocation: buildHistoryLinelocationThenLoader[Q](), + HistoryLocationtracking: buildHistoryLocationtrackingThenLoader[Q](), + HistoryMosquitoinspection: buildHistoryMosquitoinspectionThenLoader[Q](), + HistoryPointlocation: buildHistoryPointlocationThenLoader[Q](), + HistoryPolygonlocation: buildHistoryPolygonlocationThenLoader[Q](), + HistoryPool: buildHistoryPoolThenLoader[Q](), + HistoryPooldetail: buildHistoryPooldetailThenLoader[Q](), + HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaThenLoader[Q](), + HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionThenLoader[Q](), + HistoryRodentlocation: buildHistoryRodentlocationThenLoader[Q](), + HistorySamplecollection: buildHistorySamplecollectionThenLoader[Q](), + HistorySamplelocation: buildHistorySamplelocationThenLoader[Q](), + HistoryServicerequest: buildHistoryServicerequestThenLoader[Q](), + HistorySpeciesabundance: buildHistorySpeciesabundanceThenLoader[Q](), + HistoryStormdrain: buildHistoryStormdrainThenLoader[Q](), + HistoryTimecard: buildHistoryTimecardThenLoader[Q](), + HistoryTrapdatum: buildHistoryTrapdatumThenLoader[Q](), + HistoryTraplocation: buildHistoryTraplocationThenLoader[Q](), + HistoryTreatment: buildHistoryTreatmentThenLoader[Q](), + HistoryTreatmentarea: buildHistoryTreatmentareaThenLoader[Q](), + HistoryZone: buildHistoryZoneThenLoader[Q](), + HistoryZones2: buildHistoryZones2ThenLoader[Q](), + OauthToken: buildOauthTokenThenLoader[Q](), + Organization: buildOrganizationThenLoader[Q](), + User: buildUserThenLoader[Q](), } } diff --git a/models/bob_types.bob_test.go b/models/bob_types.bob_test.go index 052ca1fb..731f53fd 100644 --- a/models/bob_types.bob_test.go +++ b/models/bob_types.bob_test.go @@ -14,9 +14,171 @@ import ( // Set the testDB to enable tests that use the database var testDB bob.Transactor[bob.Tx] +// Make sure the type FSContainerrelate runs hooks after queries +var _ bob.HookableType = &FSContainerrelate{} + +// Make sure the type FSFieldscoutinglog runs hooks after queries +var _ bob.HookableType = &FSFieldscoutinglog{} + +// Make sure the type FSHabitatrelate runs hooks after queries +var _ bob.HookableType = &FSHabitatrelate{} + +// Make sure the type FSInspectionsample runs hooks after queries +var _ bob.HookableType = &FSInspectionsample{} + +// Make sure the type FSInspectionsampledetail runs hooks after queries +var _ bob.HookableType = &FSInspectionsampledetail{} + +// Make sure the type FSLinelocation runs hooks after queries +var _ bob.HookableType = &FSLinelocation{} + +// Make sure the type FSLocationtracking runs hooks after queries +var _ bob.HookableType = &FSLocationtracking{} + +// Make sure the type FSMosquitoinspection runs hooks after queries +var _ bob.HookableType = &FSMosquitoinspection{} + +// Make sure the type FSPointlocation runs hooks after queries +var _ bob.HookableType = &FSPointlocation{} + +// Make sure the type FSPolygonlocation runs hooks after queries +var _ bob.HookableType = &FSPolygonlocation{} + +// Make sure the type FSPool runs hooks after queries +var _ bob.HookableType = &FSPool{} + +// Make sure the type FSPooldetail runs hooks after queries +var _ bob.HookableType = &FSPooldetail{} + +// Make sure the type FSProposedtreatmentarea runs hooks after queries +var _ bob.HookableType = &FSProposedtreatmentarea{} + +// Make sure the type FSQamosquitoinspection runs hooks after queries +var _ bob.HookableType = &FSQamosquitoinspection{} + +// Make sure the type FSRodentlocation runs hooks after queries +var _ bob.HookableType = &FSRodentlocation{} + +// Make sure the type FSSamplecollection runs hooks after queries +var _ bob.HookableType = &FSSamplecollection{} + +// Make sure the type FSSamplelocation runs hooks after queries +var _ bob.HookableType = &FSSamplelocation{} + +// Make sure the type FSServicerequest runs hooks after queries +var _ bob.HookableType = &FSServicerequest{} + +// Make sure the type FSSpeciesabundance runs hooks after queries +var _ bob.HookableType = &FSSpeciesabundance{} + +// Make sure the type FSStormdrain runs hooks after queries +var _ bob.HookableType = &FSStormdrain{} + +// Make sure the type FSTimecard runs hooks after queries +var _ bob.HookableType = &FSTimecard{} + +// Make sure the type FSTrapdatum runs hooks after queries +var _ bob.HookableType = &FSTrapdatum{} + +// Make sure the type FSTraplocation runs hooks after queries +var _ bob.HookableType = &FSTraplocation{} + +// Make sure the type FSTreatment runs hooks after queries +var _ bob.HookableType = &FSTreatment{} + +// Make sure the type FSTreatmentarea runs hooks after queries +var _ bob.HookableType = &FSTreatmentarea{} + +// Make sure the type FSZone runs hooks after queries +var _ bob.HookableType = &FSZone{} + +// Make sure the type FSZones2 runs hooks after queries +var _ bob.HookableType = &FSZones2{} + // Make sure the type GooseDBVersion runs hooks after queries var _ bob.HookableType = &GooseDBVersion{} +// Make sure the type HistoryContainerrelate runs hooks after queries +var _ bob.HookableType = &HistoryContainerrelate{} + +// Make sure the type HistoryFieldscoutinglog runs hooks after queries +var _ bob.HookableType = &HistoryFieldscoutinglog{} + +// Make sure the type HistoryHabitatrelate runs hooks after queries +var _ bob.HookableType = &HistoryHabitatrelate{} + +// Make sure the type HistoryInspectionsample runs hooks after queries +var _ bob.HookableType = &HistoryInspectionsample{} + +// Make sure the type HistoryInspectionsampledetail runs hooks after queries +var _ bob.HookableType = &HistoryInspectionsampledetail{} + +// Make sure the type HistoryLinelocation runs hooks after queries +var _ bob.HookableType = &HistoryLinelocation{} + +// Make sure the type HistoryLocationtracking runs hooks after queries +var _ bob.HookableType = &HistoryLocationtracking{} + +// Make sure the type HistoryMosquitoinspection runs hooks after queries +var _ bob.HookableType = &HistoryMosquitoinspection{} + +// Make sure the type HistoryPointlocation runs hooks after queries +var _ bob.HookableType = &HistoryPointlocation{} + +// Make sure the type HistoryPolygonlocation runs hooks after queries +var _ bob.HookableType = &HistoryPolygonlocation{} + +// Make sure the type HistoryPool runs hooks after queries +var _ bob.HookableType = &HistoryPool{} + +// Make sure the type HistoryPooldetail runs hooks after queries +var _ bob.HookableType = &HistoryPooldetail{} + +// Make sure the type HistoryProposedtreatmentarea runs hooks after queries +var _ bob.HookableType = &HistoryProposedtreatmentarea{} + +// Make sure the type HistoryQamosquitoinspection runs hooks after queries +var _ bob.HookableType = &HistoryQamosquitoinspection{} + +// Make sure the type HistoryRodentlocation runs hooks after queries +var _ bob.HookableType = &HistoryRodentlocation{} + +// Make sure the type HistorySamplecollection runs hooks after queries +var _ bob.HookableType = &HistorySamplecollection{} + +// Make sure the type HistorySamplelocation runs hooks after queries +var _ bob.HookableType = &HistorySamplelocation{} + +// Make sure the type HistoryServicerequest runs hooks after queries +var _ bob.HookableType = &HistoryServicerequest{} + +// Make sure the type HistorySpeciesabundance runs hooks after queries +var _ bob.HookableType = &HistorySpeciesabundance{} + +// Make sure the type HistoryStormdrain runs hooks after queries +var _ bob.HookableType = &HistoryStormdrain{} + +// Make sure the type HistoryTimecard runs hooks after queries +var _ bob.HookableType = &HistoryTimecard{} + +// Make sure the type HistoryTrapdatum runs hooks after queries +var _ bob.HookableType = &HistoryTrapdatum{} + +// Make sure the type HistoryTraplocation runs hooks after queries +var _ bob.HookableType = &HistoryTraplocation{} + +// Make sure the type HistoryTreatment runs hooks after queries +var _ bob.HookableType = &HistoryTreatment{} + +// Make sure the type HistoryTreatmentarea runs hooks after queries +var _ bob.HookableType = &HistoryTreatmentarea{} + +// Make sure the type HistoryZone runs hooks after queries +var _ bob.HookableType = &HistoryZone{} + +// Make sure the type HistoryZones2 runs hooks after queries +var _ bob.HookableType = &HistoryZones2{} + // Make sure the type OauthToken runs hooks after queries var _ bob.HookableType = &OauthToken{} diff --git a/models/bob_where.bob.go b/models/bob_where.bob.go index 358ab651..68989581 100644 --- a/models/bob_where.bob.go +++ b/models/bob_where.bob.go @@ -17,23 +17,185 @@ var ( ) func Where[Q psql.Filterable]() struct { - GooseDBVersions gooseDBVersionWhere[Q] - OauthTokens oauthTokenWhere[Q] - Organizations organizationWhere[Q] - Sessions sessionWhere[Q] - Users userWhere[Q] + FSContainerrelates fsContainerrelateWhere[Q] + FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] + FSHabitatrelates fsHabitatrelateWhere[Q] + FSInspectionsamples fsInspectionsampleWhere[Q] + FSInspectionsampledetails fsInspectionsampledetailWhere[Q] + FSLinelocations fsLinelocationWhere[Q] + FSLocationtrackings fsLocationtrackingWhere[Q] + FSMosquitoinspections fsMosquitoinspectionWhere[Q] + FSPointlocations fsPointlocationWhere[Q] + FSPolygonlocations fsPolygonlocationWhere[Q] + FSPools fsPoolWhere[Q] + FSPooldetails fsPooldetailWhere[Q] + FSProposedtreatmentareas fsProposedtreatmentareaWhere[Q] + FSQamosquitoinspections fsQamosquitoinspectionWhere[Q] + FSRodentlocations fsRodentlocationWhere[Q] + FSSamplecollections fsSamplecollectionWhere[Q] + FSSamplelocations fsSamplelocationWhere[Q] + FSServicerequests fsServicerequestWhere[Q] + FSSpeciesabundances fsSpeciesabundanceWhere[Q] + FSStormdrains fsStormdrainWhere[Q] + FSTimecards fsTimecardWhere[Q] + FSTrapdata fsTrapdatumWhere[Q] + FSTraplocations fsTraplocationWhere[Q] + FSTreatments fsTreatmentWhere[Q] + FSTreatmentareas fsTreatmentareaWhere[Q] + FSZones fsZoneWhere[Q] + FSZones2s fsZones2Where[Q] + GooseDBVersions gooseDBVersionWhere[Q] + HistoryContainerrelates historyContainerrelateWhere[Q] + HistoryFieldscoutinglogs historyFieldscoutinglogWhere[Q] + HistoryHabitatrelates historyHabitatrelateWhere[Q] + HistoryInspectionsamples historyInspectionsampleWhere[Q] + HistoryInspectionsampledetails historyInspectionsampledetailWhere[Q] + HistoryLinelocations historyLinelocationWhere[Q] + HistoryLocationtrackings historyLocationtrackingWhere[Q] + HistoryMosquitoinspections historyMosquitoinspectionWhere[Q] + HistoryPointlocations historyPointlocationWhere[Q] + HistoryPolygonlocations historyPolygonlocationWhere[Q] + HistoryPools historyPoolWhere[Q] + HistoryPooldetails historyPooldetailWhere[Q] + HistoryProposedtreatmentareas historyProposedtreatmentareaWhere[Q] + HistoryQamosquitoinspections historyQamosquitoinspectionWhere[Q] + HistoryRodentlocations historyRodentlocationWhere[Q] + HistorySamplecollections historySamplecollectionWhere[Q] + HistorySamplelocations historySamplelocationWhere[Q] + HistoryServicerequests historyServicerequestWhere[Q] + HistorySpeciesabundances historySpeciesabundanceWhere[Q] + HistoryStormdrains historyStormdrainWhere[Q] + HistoryTimecards historyTimecardWhere[Q] + HistoryTrapdata historyTrapdatumWhere[Q] + HistoryTraplocations historyTraplocationWhere[Q] + HistoryTreatments historyTreatmentWhere[Q] + HistoryTreatmentareas historyTreatmentareaWhere[Q] + HistoryZones historyZoneWhere[Q] + HistoryZones2s historyZones2Where[Q] + OauthTokens oauthTokenWhere[Q] + Organizations organizationWhere[Q] + Sessions sessionWhere[Q] + Users userWhere[Q] } { return struct { - GooseDBVersions gooseDBVersionWhere[Q] - OauthTokens oauthTokenWhere[Q] - Organizations organizationWhere[Q] - Sessions sessionWhere[Q] - Users userWhere[Q] + FSContainerrelates fsContainerrelateWhere[Q] + FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] + FSHabitatrelates fsHabitatrelateWhere[Q] + FSInspectionsamples fsInspectionsampleWhere[Q] + FSInspectionsampledetails fsInspectionsampledetailWhere[Q] + FSLinelocations fsLinelocationWhere[Q] + FSLocationtrackings fsLocationtrackingWhere[Q] + FSMosquitoinspections fsMosquitoinspectionWhere[Q] + FSPointlocations fsPointlocationWhere[Q] + FSPolygonlocations fsPolygonlocationWhere[Q] + FSPools fsPoolWhere[Q] + FSPooldetails fsPooldetailWhere[Q] + FSProposedtreatmentareas fsProposedtreatmentareaWhere[Q] + FSQamosquitoinspections fsQamosquitoinspectionWhere[Q] + FSRodentlocations fsRodentlocationWhere[Q] + FSSamplecollections fsSamplecollectionWhere[Q] + FSSamplelocations fsSamplelocationWhere[Q] + FSServicerequests fsServicerequestWhere[Q] + FSSpeciesabundances fsSpeciesabundanceWhere[Q] + FSStormdrains fsStormdrainWhere[Q] + FSTimecards fsTimecardWhere[Q] + FSTrapdata fsTrapdatumWhere[Q] + FSTraplocations fsTraplocationWhere[Q] + FSTreatments fsTreatmentWhere[Q] + FSTreatmentareas fsTreatmentareaWhere[Q] + FSZones fsZoneWhere[Q] + FSZones2s fsZones2Where[Q] + GooseDBVersions gooseDBVersionWhere[Q] + HistoryContainerrelates historyContainerrelateWhere[Q] + HistoryFieldscoutinglogs historyFieldscoutinglogWhere[Q] + HistoryHabitatrelates historyHabitatrelateWhere[Q] + HistoryInspectionsamples historyInspectionsampleWhere[Q] + HistoryInspectionsampledetails historyInspectionsampledetailWhere[Q] + HistoryLinelocations historyLinelocationWhere[Q] + HistoryLocationtrackings historyLocationtrackingWhere[Q] + HistoryMosquitoinspections historyMosquitoinspectionWhere[Q] + HistoryPointlocations historyPointlocationWhere[Q] + HistoryPolygonlocations historyPolygonlocationWhere[Q] + HistoryPools historyPoolWhere[Q] + HistoryPooldetails historyPooldetailWhere[Q] + HistoryProposedtreatmentareas historyProposedtreatmentareaWhere[Q] + HistoryQamosquitoinspections historyQamosquitoinspectionWhere[Q] + HistoryRodentlocations historyRodentlocationWhere[Q] + HistorySamplecollections historySamplecollectionWhere[Q] + HistorySamplelocations historySamplelocationWhere[Q] + HistoryServicerequests historyServicerequestWhere[Q] + HistorySpeciesabundances historySpeciesabundanceWhere[Q] + HistoryStormdrains historyStormdrainWhere[Q] + HistoryTimecards historyTimecardWhere[Q] + HistoryTrapdata historyTrapdatumWhere[Q] + HistoryTraplocations historyTraplocationWhere[Q] + HistoryTreatments historyTreatmentWhere[Q] + HistoryTreatmentareas historyTreatmentareaWhere[Q] + HistoryZones historyZoneWhere[Q] + HistoryZones2s historyZones2Where[Q] + OauthTokens oauthTokenWhere[Q] + Organizations organizationWhere[Q] + Sessions sessionWhere[Q] + Users userWhere[Q] }{ - GooseDBVersions: buildGooseDBVersionWhere[Q](GooseDBVersions.Columns), - OauthTokens: buildOauthTokenWhere[Q](OauthTokens.Columns), - Organizations: buildOrganizationWhere[Q](Organizations.Columns), - Sessions: buildSessionWhere[Q](Sessions.Columns), - Users: buildUserWhere[Q](Users.Columns), + FSContainerrelates: buildFSContainerrelateWhere[Q](FSContainerrelates.Columns), + FSFieldscoutinglogs: buildFSFieldscoutinglogWhere[Q](FSFieldscoutinglogs.Columns), + FSHabitatrelates: buildFSHabitatrelateWhere[Q](FSHabitatrelates.Columns), + FSInspectionsamples: buildFSInspectionsampleWhere[Q](FSInspectionsamples.Columns), + FSInspectionsampledetails: buildFSInspectionsampledetailWhere[Q](FSInspectionsampledetails.Columns), + FSLinelocations: buildFSLinelocationWhere[Q](FSLinelocations.Columns), + FSLocationtrackings: buildFSLocationtrackingWhere[Q](FSLocationtrackings.Columns), + FSMosquitoinspections: buildFSMosquitoinspectionWhere[Q](FSMosquitoinspections.Columns), + FSPointlocations: buildFSPointlocationWhere[Q](FSPointlocations.Columns), + FSPolygonlocations: buildFSPolygonlocationWhere[Q](FSPolygonlocations.Columns), + FSPools: buildFSPoolWhere[Q](FSPools.Columns), + FSPooldetails: buildFSPooldetailWhere[Q](FSPooldetails.Columns), + FSProposedtreatmentareas: buildFSProposedtreatmentareaWhere[Q](FSProposedtreatmentareas.Columns), + FSQamosquitoinspections: buildFSQamosquitoinspectionWhere[Q](FSQamosquitoinspections.Columns), + FSRodentlocations: buildFSRodentlocationWhere[Q](FSRodentlocations.Columns), + FSSamplecollections: buildFSSamplecollectionWhere[Q](FSSamplecollections.Columns), + FSSamplelocations: buildFSSamplelocationWhere[Q](FSSamplelocations.Columns), + FSServicerequests: buildFSServicerequestWhere[Q](FSServicerequests.Columns), + FSSpeciesabundances: buildFSSpeciesabundanceWhere[Q](FSSpeciesabundances.Columns), + FSStormdrains: buildFSStormdrainWhere[Q](FSStormdrains.Columns), + FSTimecards: buildFSTimecardWhere[Q](FSTimecards.Columns), + FSTrapdata: buildFSTrapdatumWhere[Q](FSTrapdata.Columns), + FSTraplocations: buildFSTraplocationWhere[Q](FSTraplocations.Columns), + FSTreatments: buildFSTreatmentWhere[Q](FSTreatments.Columns), + FSTreatmentareas: buildFSTreatmentareaWhere[Q](FSTreatmentareas.Columns), + FSZones: buildFSZoneWhere[Q](FSZones.Columns), + FSZones2s: buildFSZones2Where[Q](FSZones2s.Columns), + GooseDBVersions: buildGooseDBVersionWhere[Q](GooseDBVersions.Columns), + HistoryContainerrelates: buildHistoryContainerrelateWhere[Q](HistoryContainerrelates.Columns), + HistoryFieldscoutinglogs: buildHistoryFieldscoutinglogWhere[Q](HistoryFieldscoutinglogs.Columns), + HistoryHabitatrelates: buildHistoryHabitatrelateWhere[Q](HistoryHabitatrelates.Columns), + HistoryInspectionsamples: buildHistoryInspectionsampleWhere[Q](HistoryInspectionsamples.Columns), + HistoryInspectionsampledetails: buildHistoryInspectionsampledetailWhere[Q](HistoryInspectionsampledetails.Columns), + HistoryLinelocations: buildHistoryLinelocationWhere[Q](HistoryLinelocations.Columns), + HistoryLocationtrackings: buildHistoryLocationtrackingWhere[Q](HistoryLocationtrackings.Columns), + HistoryMosquitoinspections: buildHistoryMosquitoinspectionWhere[Q](HistoryMosquitoinspections.Columns), + HistoryPointlocations: buildHistoryPointlocationWhere[Q](HistoryPointlocations.Columns), + HistoryPolygonlocations: buildHistoryPolygonlocationWhere[Q](HistoryPolygonlocations.Columns), + HistoryPools: buildHistoryPoolWhere[Q](HistoryPools.Columns), + HistoryPooldetails: buildHistoryPooldetailWhere[Q](HistoryPooldetails.Columns), + HistoryProposedtreatmentareas: buildHistoryProposedtreatmentareaWhere[Q](HistoryProposedtreatmentareas.Columns), + HistoryQamosquitoinspections: buildHistoryQamosquitoinspectionWhere[Q](HistoryQamosquitoinspections.Columns), + HistoryRodentlocations: buildHistoryRodentlocationWhere[Q](HistoryRodentlocations.Columns), + HistorySamplecollections: buildHistorySamplecollectionWhere[Q](HistorySamplecollections.Columns), + HistorySamplelocations: buildHistorySamplelocationWhere[Q](HistorySamplelocations.Columns), + HistoryServicerequests: buildHistoryServicerequestWhere[Q](HistoryServicerequests.Columns), + HistorySpeciesabundances: buildHistorySpeciesabundanceWhere[Q](HistorySpeciesabundances.Columns), + HistoryStormdrains: buildHistoryStormdrainWhere[Q](HistoryStormdrains.Columns), + HistoryTimecards: buildHistoryTimecardWhere[Q](HistoryTimecards.Columns), + HistoryTrapdata: buildHistoryTrapdatumWhere[Q](HistoryTrapdata.Columns), + HistoryTraplocations: buildHistoryTraplocationWhere[Q](HistoryTraplocations.Columns), + HistoryTreatments: buildHistoryTreatmentWhere[Q](HistoryTreatments.Columns), + HistoryTreatmentareas: buildHistoryTreatmentareaWhere[Q](HistoryTreatmentareas.Columns), + HistoryZones: buildHistoryZoneWhere[Q](HistoryZones.Columns), + HistoryZones2s: buildHistoryZones2Where[Q](HistoryZones2s.Columns), + OauthTokens: buildOauthTokenWhere[Q](OauthTokens.Columns), + Organizations: buildOrganizationWhere[Q](Organizations.Columns), + Sessions: buildSessionWhere[Q](Sessions.Columns), + Users: buildUserWhere[Q](Users.Columns), } } diff --git a/models/fs_containerrelate.bob.go b/models/fs_containerrelate.bob.go new file mode 100644 index 00000000..06a01240 --- /dev/null +++ b/models/fs_containerrelate.bob.go @@ -0,0 +1,1008 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSContainerrelate is an object representing the database table. +type FSContainerrelate 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" ` + Updated time.Time `db:"updated" ` + + R fsContainerrelateR `db:"-" ` +} + +// FSContainerrelateSlice is an alias for a slice of pointers to FSContainerrelate. +// This should almost always be used instead of []*FSContainerrelate. +type FSContainerrelateSlice []*FSContainerrelate + +// FSContainerrelates contains methods to work with the fs_containerrelate table +var FSContainerrelates = psql.NewTablex[*FSContainerrelate, FSContainerrelateSlice, *FSContainerrelateSetter]("", "fs_containerrelate", buildFSContainerrelateColumns("fs_containerrelate")) + +// FSContainerrelatesQuery is a query on the fs_containerrelate table +type FSContainerrelatesQuery = *psql.ViewQuery[*FSContainerrelate, FSContainerrelateSlice] + +// fsContainerrelateR is where relationships are stored. +type fsContainerrelateR struct { + Organization *Organization // fs_containerrelate.fs_containerrelate_organization_id_fkey +} + +func buildFSContainerrelateColumns(alias string) fsContainerrelateColumns { + return fsContainerrelateColumns{ + 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", "updated", + ).WithParent("fs_containerrelate"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Containertype: psql.Quote(alias, "containertype"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Inspsampleid: psql.Quote(alias, "inspsampleid"), + Mosquitoinspid: psql.Quote(alias, "mosquitoinspid"), + Objectid: psql.Quote(alias, "objectid"), + Treatmentid: psql.Quote(alias, "treatmentid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsContainerrelateColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Containertype psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Inspsampleid psql.Expression + Mosquitoinspid psql.Expression + Objectid psql.Expression + Treatmentid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsContainerrelateColumns) Alias() string { + return c.tableAlias +} + +func (fsContainerrelateColumns) AliasedAs(alias string) fsContainerrelateColumns { + return buildFSContainerrelateColumns(alias) +} + +// FSContainerrelateSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSContainerrelateSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Containertype.IsUnset() { + vals = append(vals, "containertype") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Inspsampleid.IsUnset() { + vals = append(vals, "inspsampleid") + } + if !s.Mosquitoinspid.IsUnset() { + vals = append(vals, "mosquitoinspid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Treatmentid.IsUnset() { + vals = append(vals, "treatmentid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSContainerrelateSetter) Overwrite(t *FSContainerrelate) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Containertype.IsUnset() { + t.Containertype = s.Containertype.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Inspsampleid.IsUnset() { + t.Inspsampleid = s.Inspsampleid.MustGetNull() + } + if !s.Mosquitoinspid.IsUnset() { + t.Mosquitoinspid = s.Mosquitoinspid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Treatmentid.IsUnset() { + t.Treatmentid = s.Treatmentid.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSContainerrelateSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSContainerrelates.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Containertype.IsUnset() { + vals[1] = psql.Arg(s.Containertype.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Inspsampleid.IsUnset() { + vals[7] = psql.Arg(s.Inspsampleid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Mosquitoinspid.IsUnset() { + vals[8] = psql.Arg(s.Mosquitoinspid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[9] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Treatmentid.IsUnset() { + vals[10] = psql.Arg(s.Treatmentid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[17] = psql.Arg(s.Updated.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Containertype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containertype")...), + psql.Arg(s.Containertype), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Inspsampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "inspsampleid")...), + psql.Arg(s.Inspsampleid), + }}) + } + + if !s.Mosquitoinspid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "mosquitoinspid")...), + psql.Arg(s.Mosquitoinspid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Treatmentid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentid")...), + psql.Arg(s.Treatmentid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSContainerrelate retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSContainerrelate, error) { + if len(cols) == 0 { + return FSContainerrelates.Query( + sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSContainerrelates.Query( + sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSContainerrelates.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSContainerrelateExists checks the presence of a single record by primary key +func FSContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSContainerrelates.Query( + sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSContainerrelate is retrieved from the database +func (o *FSContainerrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSContainerrelate +func (o *FSContainerrelate) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSContainerrelate) pkEQ() dialect.Expression { + return psql.Quote("fs_containerrelate", "objectid").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 FSContainerrelate +func (o *FSContainerrelate) Update(ctx context.Context, exec bob.Executor, s *FSContainerrelateSetter) error { + v, err := FSContainerrelates.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 FSContainerrelate record with an executor +func (o *FSContainerrelate) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSContainerrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSContainerrelate using the executor +func (o *FSContainerrelate) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSContainerrelates.Query( + sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSContainerrelateSlice is retrieved from the database +func (o FSContainerrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSContainerrelateSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_containerrelate", "objectid").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 FSContainerrelateSlice) copyMatchingRows(from ...*FSContainerrelate) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSContainerrelateSlice) 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 FSContainerrelates.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 *FSContainerrelate: + o.copyMatchingRows(retrieved) + case []*FSContainerrelate: + o.copyMatchingRows(retrieved...) + case FSContainerrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSContainerrelate or a slice of FSContainerrelate + // then run the AfterUpdateHooks on the slice + _, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSContainerrelateSlice) 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 FSContainerrelates.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 *FSContainerrelate: + o.copyMatchingRows(retrieved) + case []*FSContainerrelate: + o.copyMatchingRows(retrieved...) + case FSContainerrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSContainerrelate or a slice of FSContainerrelate + // then run the AfterDeleteHooks on the slice + _, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSContainerrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSContainerrelateSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSContainerrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSContainerrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSContainerrelates.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSContainerrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSContainerrelates.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 *FSContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsContainerrelate0 *FSContainerrelate, organization1 *Organization) (*FSContainerrelate, error) { + setter := &FSContainerrelateSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsContainerrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSContainerrelateOrganization0: %w", err) + } + + return fsContainerrelate0, nil +} + +func (fsContainerrelate0 *FSContainerrelate) 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 = attachFSContainerrelateOrganization0(ctx, exec, 1, fsContainerrelate0, organization1) + if err != nil { + return err + } + + fsContainerrelate0.R.Organization = organization1 + + organization1.R.FSContainerrelates = append(organization1.R.FSContainerrelates, fsContainerrelate0) + + return nil +} + +func (fsContainerrelate0 *FSContainerrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSContainerrelateOrganization0(ctx, exec, 1, fsContainerrelate0, organization1) + if err != nil { + return err + } + + fsContainerrelate0.R.Organization = organization1 + + organization1.R.FSContainerrelates = append(organization1.R.FSContainerrelates, fsContainerrelate0) + + return nil +} + +type fsContainerrelateWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Containertype psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Inspsampleid psql.WhereNullMod[Q, string] + Mosquitoinspid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Treatmentid psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsContainerrelateWhere[Q]) AliasedAs(alias string) fsContainerrelateWhere[Q] { + return buildFSContainerrelateWhere[Q](buildFSContainerrelateColumns(alias)) +} + +func buildFSContainerrelateWhere[Q psql.Filterable](cols fsContainerrelateColumns) fsContainerrelateWhere[Q] { + return fsContainerrelateWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Inspsampleid: psql.WhereNull[Q, string](cols.Inspsampleid), + Mosquitoinspid: psql.WhereNull[Q, string](cols.Mosquitoinspid), + Objectid: psql.Where[Q, int32](cols.Objectid), + Treatmentid: psql.WhereNull[Q, string](cols.Treatmentid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSContainerrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsContainerrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSContainerrelates = FSContainerrelateSlice{o} + } + return nil + default: + return fmt.Errorf("fsContainerrelate has no relationship %q", name) + } +} + +type fsContainerrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSContainerrelatePreloader() fsContainerrelatePreloader { + return fsContainerrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSContainerrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsContainerrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSContainerrelateThenLoader[Q orm.Loadable]() fsContainerrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsContainerrelateThenLoader[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 fsContainerrelate's Organization into the .R struct +func (o *FSContainerrelate) 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.FSContainerrelates = FSContainerrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsContainerrelate's Organization into the .R struct +func (os FSContainerrelateSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSContainerrelates = append(rel.R.FSContainerrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsContainerrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsContainerrelateJoins[Q]) aliasedAs(alias string) fsContainerrelateJoins[Q] { + return buildFSContainerrelateJoins[Q](buildFSContainerrelateColumns(alias), j.typ) +} + +func buildFSContainerrelateJoins[Q dialect.Joinable](cols fsContainerrelateColumns, typ string) fsContainerrelateJoins[Q] { + return fsContainerrelateJoins[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_fieldscoutinglog.bob.go b/models/fs_fieldscoutinglog.bob.go new file mode 100644 index 00000000..1a8d1cea --- /dev/null +++ b/models/fs_fieldscoutinglog.bob.go @@ -0,0 +1,933 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSFieldscoutinglog is an object representing the database table. +type FSFieldscoutinglog 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" ` + Updated time.Time `db:"updated" ` + + R fsFieldscoutinglogR `db:"-" ` +} + +// FSFieldscoutinglogSlice is an alias for a slice of pointers to FSFieldscoutinglog. +// This should almost always be used instead of []*FSFieldscoutinglog. +type FSFieldscoutinglogSlice []*FSFieldscoutinglog + +// FSFieldscoutinglogs contains methods to work with the fs_fieldscoutinglog table +var FSFieldscoutinglogs = psql.NewTablex[*FSFieldscoutinglog, FSFieldscoutinglogSlice, *FSFieldscoutinglogSetter]("", "fs_fieldscoutinglog", buildFSFieldscoutinglogColumns("fs_fieldscoutinglog")) + +// FSFieldscoutinglogsQuery is a query on the fs_fieldscoutinglog table +type FSFieldscoutinglogsQuery = *psql.ViewQuery[*FSFieldscoutinglog, FSFieldscoutinglogSlice] + +// fsFieldscoutinglogR is where relationships are stored. +type fsFieldscoutinglogR struct { + Organization *Organization // fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey +} + +func buildFSFieldscoutinglogColumns(alias string) fsFieldscoutinglogColumns { + return fsFieldscoutinglogColumns{ + 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", "updated", + ).WithParent("fs_fieldscoutinglog"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + Status: psql.Quote(alias, "status"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsFieldscoutinglogColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Objectid psql.Expression + Status psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsFieldscoutinglogColumns) Alias() string { + return c.tableAlias +} + +func (fsFieldscoutinglogColumns) AliasedAs(alias string) fsFieldscoutinglogColumns { + return buildFSFieldscoutinglogColumns(alias) +} + +// FSFieldscoutinglogSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSFieldscoutinglogSetter) SetColumns() []string { + vals := make([]string, 0, 15) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Status.IsUnset() { + vals = append(vals, "status") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSFieldscoutinglogSetter) Overwrite(t *FSFieldscoutinglog) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Status.IsUnset() { + t.Status = s.Status.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSFieldscoutinglogs.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, 15) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[6] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Status.IsUnset() { + vals[7] = psql.Arg(s.Status.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[8] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[9] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[10] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[11] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[12] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[13] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[14] = psql.Arg(s.Updated.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 15) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Status.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "status")...), + psql.Arg(s.Status), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSFieldscoutinglog retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSFieldscoutinglog(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSFieldscoutinglog, error) { + if len(cols) == 0 { + return FSFieldscoutinglogs.Query( + sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSFieldscoutinglogs.Query( + sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSFieldscoutinglogs.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSFieldscoutinglogExists checks the presence of a single record by primary key +func FSFieldscoutinglogExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSFieldscoutinglogs.Query( + sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSFieldscoutinglog is retrieved from the database +func (o *FSFieldscoutinglog) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSFieldscoutinglog +func (o *FSFieldscoutinglog) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSFieldscoutinglog) pkEQ() dialect.Expression { + return psql.Quote("fs_fieldscoutinglog", "objectid").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 FSFieldscoutinglog +func (o *FSFieldscoutinglog) Update(ctx context.Context, exec bob.Executor, s *FSFieldscoutinglogSetter) error { + v, err := FSFieldscoutinglogs.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 FSFieldscoutinglog record with an executor +func (o *FSFieldscoutinglog) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSFieldscoutinglogs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSFieldscoutinglog using the executor +func (o *FSFieldscoutinglog) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSFieldscoutinglogs.Query( + sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSFieldscoutinglogSlice is retrieved from the database +func (o FSFieldscoutinglogSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSFieldscoutinglogSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_fieldscoutinglog", "objectid").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 FSFieldscoutinglogSlice) copyMatchingRows(from ...*FSFieldscoutinglog) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSFieldscoutinglogSlice) 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 FSFieldscoutinglogs.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 *FSFieldscoutinglog: + o.copyMatchingRows(retrieved) + case []*FSFieldscoutinglog: + o.copyMatchingRows(retrieved...) + case FSFieldscoutinglogSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSFieldscoutinglog or a slice of FSFieldscoutinglog + // then run the AfterUpdateHooks on the slice + _, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSFieldscoutinglogSlice) 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 FSFieldscoutinglogs.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 *FSFieldscoutinglog: + o.copyMatchingRows(retrieved) + case []*FSFieldscoutinglog: + o.copyMatchingRows(retrieved...) + case FSFieldscoutinglogSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSFieldscoutinglog or a slice of FSFieldscoutinglog + // then run the AfterDeleteHooks on the slice + _, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSFieldscoutinglogSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSFieldscoutinglogSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSFieldscoutinglogs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSFieldscoutinglogSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSFieldscoutinglogs.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSFieldscoutinglogSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSFieldscoutinglogs.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 *FSFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglog0 *FSFieldscoutinglog, organization1 *Organization) (*FSFieldscoutinglog, error) { + setter := &FSFieldscoutinglogSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsFieldscoutinglog0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSFieldscoutinglogOrganization0: %w", err) + } + + return fsFieldscoutinglog0, nil +} + +func (fsFieldscoutinglog0 *FSFieldscoutinglog) 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 = attachFSFieldscoutinglogOrganization0(ctx, exec, 1, fsFieldscoutinglog0, organization1) + if err != nil { + return err + } + + fsFieldscoutinglog0.R.Organization = organization1 + + organization1.R.FSFieldscoutinglogs = append(organization1.R.FSFieldscoutinglogs, fsFieldscoutinglog0) + + return nil +} + +func (fsFieldscoutinglog0 *FSFieldscoutinglog) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSFieldscoutinglogOrganization0(ctx, exec, 1, fsFieldscoutinglog0, organization1) + if err != nil { + return err + } + + fsFieldscoutinglog0.R.Organization = organization1 + + organization1.R.FSFieldscoutinglogs = append(organization1.R.FSFieldscoutinglogs, fsFieldscoutinglog0) + + return nil +} + +type fsFieldscoutinglogWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Status psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsFieldscoutinglogWhere[Q]) AliasedAs(alias string) fsFieldscoutinglogWhere[Q] { + return buildFSFieldscoutinglogWhere[Q](buildFSFieldscoutinglogColumns(alias)) +} + +func buildFSFieldscoutinglogWhere[Q psql.Filterable](cols fsFieldscoutinglogColumns) fsFieldscoutinglogWhere[Q] { + return fsFieldscoutinglogWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + Status: psql.WhereNull[Q, int16](cols.Status), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSFieldscoutinglog) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsFieldscoutinglog cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSFieldscoutinglogs = FSFieldscoutinglogSlice{o} + } + return nil + default: + return fmt.Errorf("fsFieldscoutinglog has no relationship %q", name) + } +} + +type fsFieldscoutinglogPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSFieldscoutinglogPreloader() fsFieldscoutinglogPreloader { + return fsFieldscoutinglogPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSFieldscoutinglogs, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsFieldscoutinglogThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSFieldscoutinglogThenLoader[Q orm.Loadable]() fsFieldscoutinglogThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsFieldscoutinglogThenLoader[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 fsFieldscoutinglog's Organization into the .R struct +func (o *FSFieldscoutinglog) 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.FSFieldscoutinglogs = FSFieldscoutinglogSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsFieldscoutinglog's Organization into the .R struct +func (os FSFieldscoutinglogSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSFieldscoutinglogs = append(rel.R.FSFieldscoutinglogs, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsFieldscoutinglogJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsFieldscoutinglogJoins[Q]) aliasedAs(alias string) fsFieldscoutinglogJoins[Q] { + return buildFSFieldscoutinglogJoins[Q](buildFSFieldscoutinglogColumns(alias), j.typ) +} + +func buildFSFieldscoutinglogJoins[Q dialect.Joinable](cols fsFieldscoutinglogColumns, typ string) fsFieldscoutinglogJoins[Q] { + return fsFieldscoutinglogJoins[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_habitatrelate.bob.go b/models/fs_habitatrelate.bob.go new file mode 100644 index 00000000..4c584a36 --- /dev/null +++ b/models/fs_habitatrelate.bob.go @@ -0,0 +1,958 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSHabitatrelate is an object representing the database table. +type FSHabitatrelate 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" ` + Updated time.Time `db:"updated" ` + + R fsHabitatrelateR `db:"-" ` +} + +// FSHabitatrelateSlice is an alias for a slice of pointers to FSHabitatrelate. +// This should almost always be used instead of []*FSHabitatrelate. +type FSHabitatrelateSlice []*FSHabitatrelate + +// FSHabitatrelates contains methods to work with the fs_habitatrelate table +var FSHabitatrelates = psql.NewTablex[*FSHabitatrelate, FSHabitatrelateSlice, *FSHabitatrelateSetter]("", "fs_habitatrelate", buildFSHabitatrelateColumns("fs_habitatrelate")) + +// FSHabitatrelatesQuery is a query on the fs_habitatrelate table +type FSHabitatrelatesQuery = *psql.ViewQuery[*FSHabitatrelate, FSHabitatrelateSlice] + +// fsHabitatrelateR is where relationships are stored. +type fsHabitatrelateR struct { + Organization *Organization // fs_habitatrelate.fs_habitatrelate_organization_id_fkey +} + +func buildFSHabitatrelateColumns(alias string) fsHabitatrelateColumns { + return fsHabitatrelateColumns{ + 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", "updated", + ).WithParent("fs_habitatrelate"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + ForeignID: psql.Quote(alias, "foreign_id"), + Globalid: psql.Quote(alias, "globalid"), + Habitattype: psql.Quote(alias, "habitattype"), + Objectid: psql.Quote(alias, "objectid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsHabitatrelateColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + ForeignID psql.Expression + Globalid psql.Expression + Habitattype psql.Expression + Objectid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsHabitatrelateColumns) Alias() string { + return c.tableAlias +} + +func (fsHabitatrelateColumns) AliasedAs(alias string) fsHabitatrelateColumns { + return buildFSHabitatrelateColumns(alias) +} + +// FSHabitatrelateSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSHabitatrelateSetter) SetColumns() []string { + vals := make([]string, 0, 16) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.ForeignID.IsUnset() { + vals = append(vals, "foreign_id") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitattype.IsUnset() { + vals = append(vals, "habitattype") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSHabitatrelateSetter) Overwrite(t *FSHabitatrelate) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.ForeignID.IsUnset() { + t.ForeignID = s.ForeignID.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitattype.IsUnset() { + t.Habitattype = s.Habitattype.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSHabitatrelateSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSHabitatrelates.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, 16) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.ForeignID.IsUnset() { + vals[5] = psql.Arg(s.ForeignID.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Habitattype.IsUnset() { + vals[7] = psql.Arg(s.Habitattype.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[15] = psql.Arg(s.Updated.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 16) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.ForeignID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "foreign_id")...), + psql.Arg(s.ForeignID), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitattype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitattype")...), + psql.Arg(s.Habitattype), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSHabitatrelate retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSHabitatrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSHabitatrelate, error) { + if len(cols) == 0 { + return FSHabitatrelates.Query( + sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSHabitatrelates.Query( + sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSHabitatrelates.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSHabitatrelateExists checks the presence of a single record by primary key +func FSHabitatrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSHabitatrelates.Query( + sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSHabitatrelate is retrieved from the database +func (o *FSHabitatrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSHabitatrelate +func (o *FSHabitatrelate) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSHabitatrelate) pkEQ() dialect.Expression { + return psql.Quote("fs_habitatrelate", "objectid").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 FSHabitatrelate +func (o *FSHabitatrelate) Update(ctx context.Context, exec bob.Executor, s *FSHabitatrelateSetter) error { + v, err := FSHabitatrelates.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 FSHabitatrelate record with an executor +func (o *FSHabitatrelate) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSHabitatrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSHabitatrelate using the executor +func (o *FSHabitatrelate) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSHabitatrelates.Query( + sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSHabitatrelateSlice is retrieved from the database +func (o FSHabitatrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSHabitatrelateSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_habitatrelate", "objectid").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 FSHabitatrelateSlice) copyMatchingRows(from ...*FSHabitatrelate) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSHabitatrelateSlice) 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 FSHabitatrelates.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 *FSHabitatrelate: + o.copyMatchingRows(retrieved) + case []*FSHabitatrelate: + o.copyMatchingRows(retrieved...) + case FSHabitatrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSHabitatrelate or a slice of FSHabitatrelate + // then run the AfterUpdateHooks on the slice + _, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSHabitatrelateSlice) 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 FSHabitatrelates.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 *FSHabitatrelate: + o.copyMatchingRows(retrieved) + case []*FSHabitatrelate: + o.copyMatchingRows(retrieved...) + case FSHabitatrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSHabitatrelate or a slice of FSHabitatrelate + // then run the AfterDeleteHooks on the slice + _, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSHabitatrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSHabitatrelateSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSHabitatrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSHabitatrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSHabitatrelates.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSHabitatrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSHabitatrelates.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 *FSHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelate0 *FSHabitatrelate, organization1 *Organization) (*FSHabitatrelate, error) { + setter := &FSHabitatrelateSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsHabitatrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSHabitatrelateOrganization0: %w", err) + } + + return fsHabitatrelate0, nil +} + +func (fsHabitatrelate0 *FSHabitatrelate) 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 = attachFSHabitatrelateOrganization0(ctx, exec, 1, fsHabitatrelate0, organization1) + if err != nil { + return err + } + + fsHabitatrelate0.R.Organization = organization1 + + organization1.R.FSHabitatrelates = append(organization1.R.FSHabitatrelates, fsHabitatrelate0) + + return nil +} + +func (fsHabitatrelate0 *FSHabitatrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSHabitatrelateOrganization0(ctx, exec, 1, fsHabitatrelate0, organization1) + if err != nil { + return err + } + + fsHabitatrelate0.R.Organization = organization1 + + organization1.R.FSHabitatrelates = append(organization1.R.FSHabitatrelates, fsHabitatrelate0) + + return nil +} + +type fsHabitatrelateWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + ForeignID psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitattype psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsHabitatrelateWhere[Q]) AliasedAs(alias string) fsHabitatrelateWhere[Q] { + return buildFSHabitatrelateWhere[Q](buildFSHabitatrelateColumns(alias)) +} + +func buildFSHabitatrelateWhere[Q psql.Filterable](cols fsHabitatrelateColumns) fsHabitatrelateWhere[Q] { + return fsHabitatrelateWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + ForeignID: psql.WhereNull[Q, string](cols.ForeignID), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitattype: psql.WhereNull[Q, string](cols.Habitattype), + Objectid: psql.Where[Q, int32](cols.Objectid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSHabitatrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsHabitatrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSHabitatrelates = FSHabitatrelateSlice{o} + } + return nil + default: + return fmt.Errorf("fsHabitatrelate has no relationship %q", name) + } +} + +type fsHabitatrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSHabitatrelatePreloader() fsHabitatrelatePreloader { + return fsHabitatrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSHabitatrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsHabitatrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSHabitatrelateThenLoader[Q orm.Loadable]() fsHabitatrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsHabitatrelateThenLoader[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 fsHabitatrelate's Organization into the .R struct +func (o *FSHabitatrelate) 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.FSHabitatrelates = FSHabitatrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsHabitatrelate's Organization into the .R struct +func (os FSHabitatrelateSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSHabitatrelates = append(rel.R.FSHabitatrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsHabitatrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsHabitatrelateJoins[Q]) aliasedAs(alias string) fsHabitatrelateJoins[Q] { + return buildFSHabitatrelateJoins[Q](buildFSHabitatrelateColumns(alias), j.typ) +} + +func buildFSHabitatrelateJoins[Q dialect.Joinable](cols fsHabitatrelateColumns, typ string) fsHabitatrelateJoins[Q] { + return fsHabitatrelateJoins[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_inspectionsample.bob.go b/models/fs_inspectionsample.bob.go new file mode 100644 index 00000000..95045fd8 --- /dev/null +++ b/models/fs_inspectionsample.bob.go @@ -0,0 +1,1008 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSInspectionsample is an object representing the database table. +type FSInspectionsample 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" ` + Updated time.Time `db:"updated" ` + + R fsInspectionsampleR `db:"-" ` +} + +// FSInspectionsampleSlice is an alias for a slice of pointers to FSInspectionsample. +// This should almost always be used instead of []*FSInspectionsample. +type FSInspectionsampleSlice []*FSInspectionsample + +// FSInspectionsamples contains methods to work with the fs_inspectionsample table +var FSInspectionsamples = psql.NewTablex[*FSInspectionsample, FSInspectionsampleSlice, *FSInspectionsampleSetter]("", "fs_inspectionsample", buildFSInspectionsampleColumns("fs_inspectionsample")) + +// FSInspectionsamplesQuery is a query on the fs_inspectionsample table +type FSInspectionsamplesQuery = *psql.ViewQuery[*FSInspectionsample, FSInspectionsampleSlice] + +// fsInspectionsampleR is where relationships are stored. +type fsInspectionsampleR struct { + Organization *Organization // fs_inspectionsample.fs_inspectionsample_organization_id_fkey +} + +func buildFSInspectionsampleColumns(alias string) fsInspectionsampleColumns { + return fsInspectionsampleColumns{ + 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", "updated", + ).WithParent("fs_inspectionsample"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Idbytech: psql.Quote(alias, "idbytech"), + InspID: psql.Quote(alias, "insp_id"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Sampleid: psql.Quote(alias, "sampleid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsInspectionsampleColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Idbytech psql.Expression + InspID psql.Expression + Objectid psql.Expression + Processed psql.Expression + Sampleid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsInspectionsampleColumns) Alias() string { + return c.tableAlias +} + +func (fsInspectionsampleColumns) AliasedAs(alias string) fsInspectionsampleColumns { + return buildFSInspectionsampleColumns(alias) +} + +// FSInspectionsampleSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSInspectionsampleSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Idbytech.IsUnset() { + vals = append(vals, "idbytech") + } + if !s.InspID.IsUnset() { + vals = append(vals, "insp_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSInspectionsampleSetter) Overwrite(t *FSInspectionsample) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Idbytech.IsUnset() { + t.Idbytech = s.Idbytech.MustGetNull() + } + if !s.InspID.IsUnset() { + t.InspID = s.InspID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSInspectionsampleSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSInspectionsamples.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Idbytech.IsUnset() { + vals[6] = psql.Arg(s.Idbytech.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.InspID.IsUnset() { + vals[7] = psql.Arg(s.InspID.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[9] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[10] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[17] = psql.Arg(s.Updated.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Idbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "idbytech")...), + psql.Arg(s.Idbytech), + }}) + } + + if !s.InspID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "insp_id")...), + psql.Arg(s.InspID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSInspectionsample retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSInspectionsample(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSInspectionsample, error) { + if len(cols) == 0 { + return FSInspectionsamples.Query( + sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSInspectionsamples.Query( + sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSInspectionsamples.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSInspectionsampleExists checks the presence of a single record by primary key +func FSInspectionsampleExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSInspectionsamples.Query( + sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSInspectionsample is retrieved from the database +func (o *FSInspectionsample) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSInspectionsample +func (o *FSInspectionsample) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSInspectionsample) pkEQ() dialect.Expression { + return psql.Quote("fs_inspectionsample", "objectid").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 FSInspectionsample +func (o *FSInspectionsample) Update(ctx context.Context, exec bob.Executor, s *FSInspectionsampleSetter) error { + v, err := FSInspectionsamples.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 FSInspectionsample record with an executor +func (o *FSInspectionsample) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSInspectionsamples.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSInspectionsample using the executor +func (o *FSInspectionsample) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSInspectionsamples.Query( + sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSInspectionsampleSlice is retrieved from the database +func (o FSInspectionsampleSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSInspectionsampleSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_inspectionsample", "objectid").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 FSInspectionsampleSlice) copyMatchingRows(from ...*FSInspectionsample) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSInspectionsampleSlice) 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 FSInspectionsamples.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 *FSInspectionsample: + o.copyMatchingRows(retrieved) + case []*FSInspectionsample: + o.copyMatchingRows(retrieved...) + case FSInspectionsampleSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSInspectionsample or a slice of FSInspectionsample + // then run the AfterUpdateHooks on the slice + _, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSInspectionsampleSlice) 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 FSInspectionsamples.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 *FSInspectionsample: + o.copyMatchingRows(retrieved) + case []*FSInspectionsample: + o.copyMatchingRows(retrieved...) + case FSInspectionsampleSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSInspectionsample or a slice of FSInspectionsample + // then run the AfterDeleteHooks on the slice + _, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSInspectionsampleSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSInspectionsampleSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSInspectionsamples.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSInspectionsampleSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSInspectionsamples.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSInspectionsampleSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSInspectionsamples.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 *FSInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsample0 *FSInspectionsample, organization1 *Organization) (*FSInspectionsample, error) { + setter := &FSInspectionsampleSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsInspectionsample0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSInspectionsampleOrganization0: %w", err) + } + + return fsInspectionsample0, nil +} + +func (fsInspectionsample0 *FSInspectionsample) 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 = attachFSInspectionsampleOrganization0(ctx, exec, 1, fsInspectionsample0, organization1) + if err != nil { + return err + } + + fsInspectionsample0.R.Organization = organization1 + + organization1.R.FSInspectionsamples = append(organization1.R.FSInspectionsamples, fsInspectionsample0) + + return nil +} + +func (fsInspectionsample0 *FSInspectionsample) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSInspectionsampleOrganization0(ctx, exec, 1, fsInspectionsample0, organization1) + if err != nil { + return err + } + + fsInspectionsample0.R.Organization = organization1 + + organization1.R.FSInspectionsamples = append(organization1.R.FSInspectionsamples, fsInspectionsample0) + + return nil +} + +type fsInspectionsampleWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Idbytech psql.WhereNullMod[Q, string] + InspID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsInspectionsampleWhere[Q]) AliasedAs(alias string) fsInspectionsampleWhere[Q] { + return buildFSInspectionsampleWhere[Q](buildFSInspectionsampleColumns(alias)) +} + +func buildFSInspectionsampleWhere[Q psql.Filterable](cols fsInspectionsampleColumns) fsInspectionsampleWhere[Q] { + return fsInspectionsampleWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Idbytech: psql.WhereNull[Q, string](cols.Idbytech), + InspID: psql.WhereNull[Q, string](cols.InspID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSInspectionsample) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsInspectionsample cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSInspectionsamples = FSInspectionsampleSlice{o} + } + return nil + default: + return fmt.Errorf("fsInspectionsample has no relationship %q", name) + } +} + +type fsInspectionsamplePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSInspectionsamplePreloader() fsInspectionsamplePreloader { + return fsInspectionsamplePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSInspectionsamples, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsInspectionsampleThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSInspectionsampleThenLoader[Q orm.Loadable]() fsInspectionsampleThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsInspectionsampleThenLoader[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 fsInspectionsample's Organization into the .R struct +func (o *FSInspectionsample) 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.FSInspectionsamples = FSInspectionsampleSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsInspectionsample's Organization into the .R struct +func (os FSInspectionsampleSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSInspectionsamples = append(rel.R.FSInspectionsamples, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsInspectionsampleJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsInspectionsampleJoins[Q]) aliasedAs(alias string) fsInspectionsampleJoins[Q] { + return buildFSInspectionsampleJoins[Q](buildFSInspectionsampleColumns(alias), j.typ) +} + +func buildFSInspectionsampleJoins[Q dialect.Joinable](cols fsInspectionsampleColumns, typ string) fsInspectionsampleJoins[Q] { + return fsInspectionsampleJoins[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_inspectionsampledetail.bob.go b/models/fs_inspectionsampledetail.bob.go new file mode 100644 index 00000000..b1a4bd68 --- /dev/null +++ b/models/fs_inspectionsampledetail.bob.go @@ -0,0 +1,1283 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSInspectionsampledetail is an object representing the database table. +type FSInspectionsampledetail 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" ` + Updated time.Time `db:"updated" ` + + R fsInspectionsampledetailR `db:"-" ` +} + +// FSInspectionsampledetailSlice is an alias for a slice of pointers to FSInspectionsampledetail. +// This should almost always be used instead of []*FSInspectionsampledetail. +type FSInspectionsampledetailSlice []*FSInspectionsampledetail + +// FSInspectionsampledetails contains methods to work with the fs_inspectionsampledetail table +var FSInspectionsampledetails = psql.NewTablex[*FSInspectionsampledetail, FSInspectionsampledetailSlice, *FSInspectionsampledetailSetter]("", "fs_inspectionsampledetail", buildFSInspectionsampledetailColumns("fs_inspectionsampledetail")) + +// FSInspectionsampledetailsQuery is a query on the fs_inspectionsampledetail table +type FSInspectionsampledetailsQuery = *psql.ViewQuery[*FSInspectionsampledetail, FSInspectionsampledetailSlice] + +// fsInspectionsampledetailR is where relationships are stored. +type fsInspectionsampledetailR struct { + Organization *Organization // fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey +} + +func buildFSInspectionsampledetailColumns(alias string) fsInspectionsampledetailColumns { + return fsInspectionsampledetailColumns{ + 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", "updated", + ).WithParent("fs_inspectionsampledetail"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fadultact: psql.Quote(alias, "fadultact"), + Fdomstage: psql.Quote(alias, "fdomstage"), + Feggcount: psql.Quote(alias, "feggcount"), + Fieldspecies: psql.Quote(alias, "fieldspecies"), + Flarvcount: psql.Quote(alias, "flarvcount"), + Flstages: psql.Quote(alias, "flstages"), + Fpupcount: psql.Quote(alias, "fpupcount"), + Globalid: psql.Quote(alias, "globalid"), + InspsampleID: psql.Quote(alias, "inspsample_id"), + Labspecies: psql.Quote(alias, "labspecies"), + Ldomstage: psql.Quote(alias, "ldomstage"), + Leggcount: psql.Quote(alias, "leggcount"), + Llarvcount: psql.Quote(alias, "llarvcount"), + Lpupcount: psql.Quote(alias, "lpupcount"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsInspectionsampledetailColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fadultact psql.Expression + Fdomstage psql.Expression + Feggcount psql.Expression + Fieldspecies psql.Expression + Flarvcount psql.Expression + Flstages psql.Expression + Fpupcount psql.Expression + Globalid psql.Expression + InspsampleID psql.Expression + Labspecies psql.Expression + Ldomstage psql.Expression + Leggcount psql.Expression + Llarvcount psql.Expression + Lpupcount psql.Expression + Objectid psql.Expression + Processed psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsInspectionsampledetailColumns) Alias() string { + return c.tableAlias +} + +func (fsInspectionsampledetailColumns) AliasedAs(alias string) fsInspectionsampledetailColumns { + return buildFSInspectionsampledetailColumns(alias) +} + +// FSInspectionsampledetailSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSInspectionsampledetailSetter) SetColumns() []string { + vals := make([]string, 0, 29) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fadultact.IsUnset() { + vals = append(vals, "fadultact") + } + if !s.Fdomstage.IsUnset() { + vals = append(vals, "fdomstage") + } + if !s.Feggcount.IsUnset() { + vals = append(vals, "feggcount") + } + if !s.Fieldspecies.IsUnset() { + vals = append(vals, "fieldspecies") + } + if !s.Flarvcount.IsUnset() { + vals = append(vals, "flarvcount") + } + if !s.Flstages.IsUnset() { + vals = append(vals, "flstages") + } + if !s.Fpupcount.IsUnset() { + vals = append(vals, "fpupcount") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.InspsampleID.IsUnset() { + vals = append(vals, "inspsample_id") + } + if !s.Labspecies.IsUnset() { + vals = append(vals, "labspecies") + } + if !s.Ldomstage.IsUnset() { + vals = append(vals, "ldomstage") + } + if !s.Leggcount.IsUnset() { + vals = append(vals, "leggcount") + } + if !s.Llarvcount.IsUnset() { + vals = append(vals, "llarvcount") + } + if !s.Lpupcount.IsUnset() { + vals = append(vals, "lpupcount") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSInspectionsampledetailSetter) Overwrite(t *FSInspectionsampledetail) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fadultact.IsUnset() { + t.Fadultact = s.Fadultact.MustGetNull() + } + if !s.Fdomstage.IsUnset() { + t.Fdomstage = s.Fdomstage.MustGetNull() + } + if !s.Feggcount.IsUnset() { + t.Feggcount = s.Feggcount.MustGetNull() + } + if !s.Fieldspecies.IsUnset() { + t.Fieldspecies = s.Fieldspecies.MustGetNull() + } + if !s.Flarvcount.IsUnset() { + t.Flarvcount = s.Flarvcount.MustGetNull() + } + if !s.Flstages.IsUnset() { + t.Flstages = s.Flstages.MustGetNull() + } + if !s.Fpupcount.IsUnset() { + t.Fpupcount = s.Fpupcount.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.InspsampleID.IsUnset() { + t.InspsampleID = s.InspsampleID.MustGetNull() + } + if !s.Labspecies.IsUnset() { + t.Labspecies = s.Labspecies.MustGetNull() + } + if !s.Ldomstage.IsUnset() { + t.Ldomstage = s.Ldomstage.MustGetNull() + } + if !s.Leggcount.IsUnset() { + t.Leggcount = s.Leggcount.MustGetNull() + } + if !s.Llarvcount.IsUnset() { + t.Llarvcount = s.Llarvcount.MustGetNull() + } + if !s.Lpupcount.IsUnset() { + t.Lpupcount = s.Lpupcount.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSInspectionsampledetails.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, 29) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Fadultact.IsUnset() { + vals[6] = psql.Arg(s.Fadultact.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Fdomstage.IsUnset() { + vals[7] = psql.Arg(s.Fdomstage.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Feggcount.IsUnset() { + vals[8] = psql.Arg(s.Feggcount.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Fieldspecies.IsUnset() { + vals[9] = psql.Arg(s.Fieldspecies.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Flarvcount.IsUnset() { + vals[10] = psql.Arg(s.Flarvcount.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Flstages.IsUnset() { + vals[11] = psql.Arg(s.Flstages.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Fpupcount.IsUnset() { + vals[12] = psql.Arg(s.Fpupcount.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[13] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.InspsampleID.IsUnset() { + vals[14] = psql.Arg(s.InspsampleID.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Labspecies.IsUnset() { + vals[15] = psql.Arg(s.Labspecies.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Ldomstage.IsUnset() { + vals[16] = psql.Arg(s.Ldomstage.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Leggcount.IsUnset() { + vals[17] = psql.Arg(s.Leggcount.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Llarvcount.IsUnset() { + vals[18] = psql.Arg(s.Llarvcount.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lpupcount.IsUnset() { + vals[19] = psql.Arg(s.Lpupcount.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[20] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[21] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[28] = psql.Arg(s.Updated.MustGet()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 29) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fadultact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fadultact")...), + psql.Arg(s.Fadultact), + }}) + } + + if !s.Fdomstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fdomstage")...), + psql.Arg(s.Fdomstage), + }}) + } + + if !s.Feggcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "feggcount")...), + psql.Arg(s.Feggcount), + }}) + } + + if !s.Fieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldspecies")...), + psql.Arg(s.Fieldspecies), + }}) + } + + if !s.Flarvcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flarvcount")...), + psql.Arg(s.Flarvcount), + }}) + } + + if !s.Flstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flstages")...), + psql.Arg(s.Flstages), + }}) + } + + if !s.Fpupcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fpupcount")...), + psql.Arg(s.Fpupcount), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.InspsampleID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "inspsample_id")...), + psql.Arg(s.InspsampleID), + }}) + } + + if !s.Labspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "labspecies")...), + psql.Arg(s.Labspecies), + }}) + } + + if !s.Ldomstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ldomstage")...), + psql.Arg(s.Ldomstage), + }}) + } + + if !s.Leggcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "leggcount")...), + psql.Arg(s.Leggcount), + }}) + } + + if !s.Llarvcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "llarvcount")...), + psql.Arg(s.Llarvcount), + }}) + } + + if !s.Lpupcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lpupcount")...), + psql.Arg(s.Lpupcount), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSInspectionsampledetail retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSInspectionsampledetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSInspectionsampledetail, error) { + if len(cols) == 0 { + return FSInspectionsampledetails.Query( + sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSInspectionsampledetails.Query( + sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSInspectionsampledetails.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSInspectionsampledetailExists checks the presence of a single record by primary key +func FSInspectionsampledetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSInspectionsampledetails.Query( + sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSInspectionsampledetail is retrieved from the database +func (o *FSInspectionsampledetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSInspectionsampledetail +func (o *FSInspectionsampledetail) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSInspectionsampledetail) pkEQ() dialect.Expression { + return psql.Quote("fs_inspectionsampledetail", "objectid").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 FSInspectionsampledetail +func (o *FSInspectionsampledetail) Update(ctx context.Context, exec bob.Executor, s *FSInspectionsampledetailSetter) error { + v, err := FSInspectionsampledetails.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 FSInspectionsampledetail record with an executor +func (o *FSInspectionsampledetail) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSInspectionsampledetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSInspectionsampledetail using the executor +func (o *FSInspectionsampledetail) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSInspectionsampledetails.Query( + sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSInspectionsampledetailSlice is retrieved from the database +func (o FSInspectionsampledetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSInspectionsampledetailSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_inspectionsampledetail", "objectid").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 FSInspectionsampledetailSlice) copyMatchingRows(from ...*FSInspectionsampledetail) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSInspectionsampledetailSlice) 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 FSInspectionsampledetails.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 *FSInspectionsampledetail: + o.copyMatchingRows(retrieved) + case []*FSInspectionsampledetail: + o.copyMatchingRows(retrieved...) + case FSInspectionsampledetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSInspectionsampledetail or a slice of FSInspectionsampledetail + // then run the AfterUpdateHooks on the slice + _, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSInspectionsampledetailSlice) 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 FSInspectionsampledetails.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 *FSInspectionsampledetail: + o.copyMatchingRows(retrieved) + case []*FSInspectionsampledetail: + o.copyMatchingRows(retrieved...) + case FSInspectionsampledetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSInspectionsampledetail or a slice of FSInspectionsampledetail + // then run the AfterDeleteHooks on the slice + _, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSInspectionsampledetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSInspectionsampledetailSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSInspectionsampledetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSInspectionsampledetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSInspectionsampledetails.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSInspectionsampledetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSInspectionsampledetails.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 *FSInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSInspectionsampledetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetail0 *FSInspectionsampledetail, organization1 *Organization) (*FSInspectionsampledetail, error) { + setter := &FSInspectionsampledetailSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsInspectionsampledetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSInspectionsampledetailOrganization0: %w", err) + } + + return fsInspectionsampledetail0, nil +} + +func (fsInspectionsampledetail0 *FSInspectionsampledetail) 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 = attachFSInspectionsampledetailOrganization0(ctx, exec, 1, fsInspectionsampledetail0, organization1) + if err != nil { + return err + } + + fsInspectionsampledetail0.R.Organization = organization1 + + organization1.R.FSInspectionsampledetails = append(organization1.R.FSInspectionsampledetails, fsInspectionsampledetail0) + + return nil +} + +func (fsInspectionsampledetail0 *FSInspectionsampledetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSInspectionsampledetailOrganization0(ctx, exec, 1, fsInspectionsampledetail0, organization1) + if err != nil { + return err + } + + fsInspectionsampledetail0.R.Organization = organization1 + + organization1.R.FSInspectionsampledetails = append(organization1.R.FSInspectionsampledetails, fsInspectionsampledetail0) + + return nil +} + +type fsInspectionsampledetailWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fadultact psql.WhereNullMod[Q, string] + Fdomstage psql.WhereNullMod[Q, string] + Feggcount psql.WhereNullMod[Q, int16] + Fieldspecies psql.WhereNullMod[Q, string] + Flarvcount psql.WhereNullMod[Q, int16] + Flstages psql.WhereNullMod[Q, string] + Fpupcount psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + InspsampleID psql.WhereNullMod[Q, string] + Labspecies psql.WhereNullMod[Q, string] + Ldomstage psql.WhereNullMod[Q, string] + Leggcount psql.WhereNullMod[Q, int16] + Llarvcount psql.WhereNullMod[Q, int16] + Lpupcount psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsInspectionsampledetailWhere[Q]) AliasedAs(alias string) fsInspectionsampledetailWhere[Q] { + return buildFSInspectionsampledetailWhere[Q](buildFSInspectionsampledetailColumns(alias)) +} + +func buildFSInspectionsampledetailWhere[Q psql.Filterable](cols fsInspectionsampledetailColumns) fsInspectionsampledetailWhere[Q] { + return fsInspectionsampledetailWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fadultact: psql.WhereNull[Q, string](cols.Fadultact), + Fdomstage: psql.WhereNull[Q, string](cols.Fdomstage), + Feggcount: psql.WhereNull[Q, int16](cols.Feggcount), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), + Flarvcount: psql.WhereNull[Q, int16](cols.Flarvcount), + Flstages: psql.WhereNull[Q, string](cols.Flstages), + Fpupcount: psql.WhereNull[Q, int16](cols.Fpupcount), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + InspsampleID: psql.WhereNull[Q, string](cols.InspsampleID), + Labspecies: psql.WhereNull[Q, string](cols.Labspecies), + Ldomstage: psql.WhereNull[Q, string](cols.Ldomstage), + Leggcount: psql.WhereNull[Q, int16](cols.Leggcount), + Llarvcount: psql.WhereNull[Q, int16](cols.Llarvcount), + Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSInspectionsampledetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsInspectionsampledetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSInspectionsampledetails = FSInspectionsampledetailSlice{o} + } + return nil + default: + return fmt.Errorf("fsInspectionsampledetail has no relationship %q", name) + } +} + +type fsInspectionsampledetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSInspectionsampledetailPreloader() fsInspectionsampledetailPreloader { + return fsInspectionsampledetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSInspectionsampledetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsInspectionsampledetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSInspectionsampledetailThenLoader[Q orm.Loadable]() fsInspectionsampledetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsInspectionsampledetailThenLoader[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 fsInspectionsampledetail's Organization into the .R struct +func (o *FSInspectionsampledetail) 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.FSInspectionsampledetails = FSInspectionsampledetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsInspectionsampledetail's Organization into the .R struct +func (os FSInspectionsampledetailSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSInspectionsampledetails = append(rel.R.FSInspectionsampledetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsInspectionsampledetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsInspectionsampledetailJoins[Q]) aliasedAs(alias string) fsInspectionsampledetailJoins[Q] { + return buildFSInspectionsampledetailJoins[Q](buildFSInspectionsampledetailColumns(alias), j.typ) +} + +func buildFSInspectionsampledetailJoins[Q dialect.Joinable](cols fsInspectionsampledetailColumns, typ string) fsInspectionsampledetailJoins[Q] { + return fsInspectionsampledetailJoins[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_linelocation.bob.go b/models/fs_linelocation.bob.go new file mode 100644 index 00000000..673d4d94 --- /dev/null +++ b/models/fs_linelocation.bob.go @@ -0,0 +1,1858 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSLinelocation is an object representing the database table. +type FSLinelocation 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" ` + Updated time.Time `db:"updated" ` + + R fsLinelocationR `db:"-" ` +} + +// FSLinelocationSlice is an alias for a slice of pointers to FSLinelocation. +// This should almost always be used instead of []*FSLinelocation. +type FSLinelocationSlice []*FSLinelocation + +// FSLinelocations contains methods to work with the fs_linelocation table +var FSLinelocations = psql.NewTablex[*FSLinelocation, FSLinelocationSlice, *FSLinelocationSetter]("", "fs_linelocation", buildFSLinelocationColumns("fs_linelocation")) + +// FSLinelocationsQuery is a query on the fs_linelocation table +type FSLinelocationsQuery = *psql.ViewQuery[*FSLinelocation, FSLinelocationSlice] + +// fsLinelocationR is where relationships are stored. +type fsLinelocationR struct { + Organization *Organization // fs_linelocation.fs_linelocation_organization_id_fkey +} + +func buildFSLinelocationColumns(alias string) fsLinelocationColumns { + return fsLinelocationColumns{ + 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", "updated", + ).WithParent("fs_linelocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Acres: psql.Quote(alias, "acres"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Hectares: psql.Quote(alias, "hectares"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + LengthFT: psql.Quote(alias, "length_ft"), + LengthMeters: psql.Quote(alias, "length_meters"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + ShapeLength: psql.Quote(alias, "shape__length"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + WidthFT: psql.Quote(alias, "width_ft"), + WidthMeters: psql.Quote(alias, "width_meters"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsLinelocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Acres psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Hectares psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + LengthFT psql.Expression + LengthMeters psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + ShapeLength psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + WidthFT psql.Expression + WidthMeters psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsLinelocationColumns) Alias() string { + return c.tableAlias +} + +func (fsLinelocationColumns) AliasedAs(alias string) fsLinelocationColumns { + return buildFSLinelocationColumns(alias) +} + +// FSLinelocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSLinelocationSetter) SetColumns() []string { + vals := make([]string, 0, 52) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.LengthFT.IsUnset() { + vals = append(vals, "length_ft") + } + if !s.LengthMeters.IsUnset() { + vals = append(vals, "length_meters") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.WidthFT.IsUnset() { + vals = append(vals, "width_ft") + } + if !s.WidthMeters.IsUnset() { + vals = append(vals, "width_meters") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSLinelocationSetter) Overwrite(t *FSLinelocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.LengthFT.IsUnset() { + t.LengthFT = s.LengthFT.MustGetNull() + } + if !s.LengthMeters.IsUnset() { + t.LengthMeters = s.LengthMeters.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.WidthFT.IsUnset() { + t.WidthFT = s.WidthFT.MustGetNull() + } + if !s.WidthMeters.IsUnset() { + t.WidthMeters = s.WidthMeters.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSLinelocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSLinelocations.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, 52) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[2] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[3] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[7] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[8] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[9] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[10] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[13] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[14] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[15] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[23] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[24] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[25] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[28] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[29] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.LengthFT.IsUnset() { + vals[30] = psql.Arg(s.LengthFT.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.LengthMeters.IsUnset() { + vals[31] = psql.Arg(s.LengthMeters.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[32] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[33] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[34] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[35] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[36] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[37] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[39] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.WidthFT.IsUnset() { + vals[41] = psql.Arg(s.WidthFT.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.WidthMeters.IsUnset() { + vals[42] = psql.Arg(s.WidthMeters.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[43] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[44] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[45] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[46] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[47] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[48] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[49] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[50] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[51] = psql.Arg(s.Updated.MustGet()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSLinelocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 52) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.LengthFT.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "length_ft")...), + psql.Arg(s.LengthFT), + }}) + } + + if !s.LengthMeters.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "length_meters")...), + psql.Arg(s.LengthMeters), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.WidthFT.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "width_ft")...), + psql.Arg(s.WidthFT), + }}) + } + + if !s.WidthMeters.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "width_meters")...), + psql.Arg(s.WidthMeters), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSLinelocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSLinelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSLinelocation, error) { + if len(cols) == 0 { + return FSLinelocations.Query( + sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSLinelocations.Query( + sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSLinelocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSLinelocationExists checks the presence of a single record by primary key +func FSLinelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSLinelocations.Query( + sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSLinelocation is retrieved from the database +func (o *FSLinelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSLinelocations.AfterSelectHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSLinelocations.AfterInsertHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSLinelocation +func (o *FSLinelocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSLinelocation) pkEQ() dialect.Expression { + return psql.Quote("fs_linelocation", "objectid").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 FSLinelocation +func (o *FSLinelocation) Update(ctx context.Context, exec bob.Executor, s *FSLinelocationSetter) error { + v, err := FSLinelocations.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 FSLinelocation record with an executor +func (o *FSLinelocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSLinelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSLinelocation using the executor +func (o *FSLinelocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSLinelocations.Query( + sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSLinelocationSlice is retrieved from the database +func (o FSLinelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSLinelocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSLinelocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSLinelocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_linelocation", "objectid").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 FSLinelocationSlice) copyMatchingRows(from ...*FSLinelocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSLinelocationSlice) 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 FSLinelocations.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 *FSLinelocation: + o.copyMatchingRows(retrieved) + case []*FSLinelocation: + o.copyMatchingRows(retrieved...) + case FSLinelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSLinelocation or a slice of FSLinelocation + // then run the AfterUpdateHooks on the slice + _, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSLinelocationSlice) 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 FSLinelocations.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 *FSLinelocation: + o.copyMatchingRows(retrieved) + case []*FSLinelocation: + o.copyMatchingRows(retrieved...) + case FSLinelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSLinelocation or a slice of FSLinelocation + // then run the AfterDeleteHooks on the slice + _, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSLinelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSLinelocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSLinelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSLinelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSLinelocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSLinelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSLinelocations.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 *FSLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsLinelocation0 *FSLinelocation, organization1 *Organization) (*FSLinelocation, error) { + setter := &FSLinelocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsLinelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSLinelocationOrganization0: %w", err) + } + + return fsLinelocation0, nil +} + +func (fsLinelocation0 *FSLinelocation) 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 = attachFSLinelocationOrganization0(ctx, exec, 1, fsLinelocation0, organization1) + if err != nil { + return err + } + + fsLinelocation0.R.Organization = organization1 + + organization1.R.FSLinelocations = append(organization1.R.FSLinelocations, fsLinelocation0) + + return nil +} + +func (fsLinelocation0 *FSLinelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSLinelocationOrganization0(ctx, exec, 1, fsLinelocation0, organization1) + if err != nil { + return err + } + + fsLinelocation0.R.Organization = organization1 + + organization1.R.FSLinelocations = append(organization1.R.FSLinelocations, fsLinelocation0) + + return nil +} + +type fsLinelocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Acres psql.WhereNullMod[Q, float64] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + LengthFT psql.WhereNullMod[Q, float64] + LengthMeters psql.WhereNullMod[Q, float64] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + ShapeLength psql.WhereNullMod[Q, float64] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + WidthFT psql.WhereNullMod[Q, float64] + WidthMeters psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsLinelocationWhere[Q]) AliasedAs(alias string) fsLinelocationWhere[Q] { + return buildFSLinelocationWhere[Q](buildFSLinelocationColumns(alias)) +} + +func buildFSLinelocationWhere[Q psql.Filterable](cols fsLinelocationColumns) fsLinelocationWhere[Q] { + return fsLinelocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + LengthFT: psql.WhereNull[Q, float64](cols.LengthFT), + LengthMeters: psql.WhereNull[Q, float64](cols.LengthMeters), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + WidthFT: psql.WhereNull[Q, float64](cols.WidthFT), + WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSLinelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsLinelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSLinelocations = FSLinelocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsLinelocation has no relationship %q", name) + } +} + +type fsLinelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSLinelocationPreloader() fsLinelocationPreloader { + return fsLinelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSLinelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsLinelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSLinelocationThenLoader[Q orm.Loadable]() fsLinelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsLinelocationThenLoader[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 fsLinelocation's Organization into the .R struct +func (o *FSLinelocation) 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.FSLinelocations = FSLinelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsLinelocation's Organization into the .R struct +func (os FSLinelocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSLinelocations = append(rel.R.FSLinelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsLinelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsLinelocationJoins[Q]) aliasedAs(alias string) fsLinelocationJoins[Q] { + return buildFSLinelocationJoins[Q](buildFSLinelocationColumns(alias), j.typ) +} + +func buildFSLinelocationJoins[Q dialect.Joinable](cols fsLinelocationColumns, typ string) fsLinelocationJoins[Q] { + return fsLinelocationJoins[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_locationtracking.bob.go b/models/fs_locationtracking.bob.go new file mode 100644 index 00000000..06378f5e --- /dev/null +++ b/models/fs_locationtracking.bob.go @@ -0,0 +1,958 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSLocationtracking is an object representing the database table. +type FSLocationtracking 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" ` + Updated time.Time `db:"updated" ` + + R fsLocationtrackingR `db:"-" ` +} + +// FSLocationtrackingSlice is an alias for a slice of pointers to FSLocationtracking. +// This should almost always be used instead of []*FSLocationtracking. +type FSLocationtrackingSlice []*FSLocationtracking + +// FSLocationtrackings contains methods to work with the fs_locationtracking table +var FSLocationtrackings = psql.NewTablex[*FSLocationtracking, FSLocationtrackingSlice, *FSLocationtrackingSetter]("", "fs_locationtracking", buildFSLocationtrackingColumns("fs_locationtracking")) + +// FSLocationtrackingsQuery is a query on the fs_locationtracking table +type FSLocationtrackingsQuery = *psql.ViewQuery[*FSLocationtracking, FSLocationtrackingSlice] + +// fsLocationtrackingR is where relationships are stored. +type fsLocationtrackingR struct { + Organization *Organization // fs_locationtracking.fs_locationtracking_organization_id_fkey +} + +func buildFSLocationtrackingColumns(alias string) fsLocationtrackingColumns { + return fsLocationtrackingColumns{ + 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", "updated", + ).WithParent("fs_locationtracking"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accuracy: psql.Quote(alias, "accuracy"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsLocationtrackingColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accuracy psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Objectid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsLocationtrackingColumns) Alias() string { + return c.tableAlias +} + +func (fsLocationtrackingColumns) AliasedAs(alias string) fsLocationtrackingColumns { + return buildFSLocationtrackingColumns(alias) +} + +// FSLocationtrackingSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSLocationtrackingSetter) SetColumns() []string { + vals := make([]string, 0, 16) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accuracy.IsUnset() { + vals = append(vals, "accuracy") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSLocationtrackingSetter) Overwrite(t *FSLocationtracking) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accuracy.IsUnset() { + t.Accuracy = s.Accuracy.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSLocationtrackingSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSLocationtrackings.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, 16) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accuracy.IsUnset() { + vals[1] = psql.Arg(s.Accuracy.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[6] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[7] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[15] = psql.Arg(s.Updated.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 16) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accuracy.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accuracy")...), + psql.Arg(s.Accuracy), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSLocationtracking retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSLocationtracking(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSLocationtracking, error) { + if len(cols) == 0 { + return FSLocationtrackings.Query( + sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSLocationtrackings.Query( + sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSLocationtrackings.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSLocationtrackingExists checks the presence of a single record by primary key +func FSLocationtrackingExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSLocationtrackings.Query( + sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSLocationtracking is retrieved from the database +func (o *FSLocationtracking) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSLocationtracking +func (o *FSLocationtracking) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSLocationtracking) pkEQ() dialect.Expression { + return psql.Quote("fs_locationtracking", "objectid").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 FSLocationtracking +func (o *FSLocationtracking) Update(ctx context.Context, exec bob.Executor, s *FSLocationtrackingSetter) error { + v, err := FSLocationtrackings.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 FSLocationtracking record with an executor +func (o *FSLocationtracking) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSLocationtrackings.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSLocationtracking using the executor +func (o *FSLocationtracking) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSLocationtrackings.Query( + sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSLocationtrackingSlice is retrieved from the database +func (o FSLocationtrackingSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSLocationtrackingSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_locationtracking", "objectid").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 FSLocationtrackingSlice) copyMatchingRows(from ...*FSLocationtracking) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSLocationtrackingSlice) 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 FSLocationtrackings.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 *FSLocationtracking: + o.copyMatchingRows(retrieved) + case []*FSLocationtracking: + o.copyMatchingRows(retrieved...) + case FSLocationtrackingSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSLocationtracking or a slice of FSLocationtracking + // then run the AfterUpdateHooks on the slice + _, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSLocationtrackingSlice) 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 FSLocationtrackings.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 *FSLocationtracking: + o.copyMatchingRows(retrieved) + case []*FSLocationtracking: + o.copyMatchingRows(retrieved...) + case FSLocationtrackingSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSLocationtracking or a slice of FSLocationtracking + // then run the AfterDeleteHooks on the slice + _, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSLocationtrackingSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSLocationtrackingSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSLocationtrackings.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSLocationtrackingSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSLocationtrackings.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSLocationtrackingSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSLocationtrackings.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 *FSLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, fsLocationtracking0 *FSLocationtracking, organization1 *Organization) (*FSLocationtracking, error) { + setter := &FSLocationtrackingSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsLocationtracking0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSLocationtrackingOrganization0: %w", err) + } + + return fsLocationtracking0, nil +} + +func (fsLocationtracking0 *FSLocationtracking) 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 = attachFSLocationtrackingOrganization0(ctx, exec, 1, fsLocationtracking0, organization1) + if err != nil { + return err + } + + fsLocationtracking0.R.Organization = organization1 + + organization1.R.FSLocationtrackings = append(organization1.R.FSLocationtrackings, fsLocationtracking0) + + return nil +} + +func (fsLocationtracking0 *FSLocationtracking) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSLocationtrackingOrganization0(ctx, exec, 1, fsLocationtracking0, organization1) + if err != nil { + return err + } + + fsLocationtracking0.R.Organization = organization1 + + organization1.R.FSLocationtrackings = append(organization1.R.FSLocationtrackings, fsLocationtracking0) + + return nil +} + +type fsLocationtrackingWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accuracy psql.WhereNullMod[Q, float64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsLocationtrackingWhere[Q]) AliasedAs(alias string) fsLocationtrackingWhere[Q] { + return buildFSLocationtrackingWhere[Q](buildFSLocationtrackingColumns(alias)) +} + +func buildFSLocationtrackingWhere[Q psql.Filterable](cols fsLocationtrackingColumns) fsLocationtrackingWhere[Q] { + return fsLocationtrackingWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSLocationtracking) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsLocationtracking cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSLocationtrackings = FSLocationtrackingSlice{o} + } + return nil + default: + return fmt.Errorf("fsLocationtracking has no relationship %q", name) + } +} + +type fsLocationtrackingPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSLocationtrackingPreloader() fsLocationtrackingPreloader { + return fsLocationtrackingPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSLocationtrackings, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsLocationtrackingThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSLocationtrackingThenLoader[Q orm.Loadable]() fsLocationtrackingThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsLocationtrackingThenLoader[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 fsLocationtracking's Organization into the .R struct +func (o *FSLocationtracking) 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.FSLocationtrackings = FSLocationtrackingSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsLocationtracking's Organization into the .R struct +func (os FSLocationtrackingSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSLocationtrackings = append(rel.R.FSLocationtrackings, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsLocationtrackingJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsLocationtrackingJoins[Q]) aliasedAs(alias string) fsLocationtrackingJoins[Q] { + return buildFSLocationtrackingJoins[Q](buildFSLocationtrackingColumns(alias), j.typ) +} + +func buildFSLocationtrackingJoins[Q dialect.Joinable](cols fsLocationtrackingColumns, typ string) fsLocationtrackingJoins[Q] { + return fsLocationtrackingJoins[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_mosquitoinspection.bob.go b/models/fs_mosquitoinspection.bob.go new file mode 100644 index 00000000..50c4d1e4 --- /dev/null +++ b/models/fs_mosquitoinspection.bob.go @@ -0,0 +1,2083 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSMosquitoinspection is an object representing the database table. +type FSMosquitoinspection 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" ` + Updated time.Time `db:"updated" ` + + R fsMosquitoinspectionR `db:"-" ` +} + +// FSMosquitoinspectionSlice is an alias for a slice of pointers to FSMosquitoinspection. +// This should almost always be used instead of []*FSMosquitoinspection. +type FSMosquitoinspectionSlice []*FSMosquitoinspection + +// FSMosquitoinspections contains methods to work with the fs_mosquitoinspection table +var FSMosquitoinspections = psql.NewTablex[*FSMosquitoinspection, FSMosquitoinspectionSlice, *FSMosquitoinspectionSetter]("", "fs_mosquitoinspection", buildFSMosquitoinspectionColumns("fs_mosquitoinspection")) + +// FSMosquitoinspectionsQuery is a query on the fs_mosquitoinspection table +type FSMosquitoinspectionsQuery = *psql.ViewQuery[*FSMosquitoinspection, FSMosquitoinspectionSlice] + +// fsMosquitoinspectionR is where relationships are stored. +type fsMosquitoinspectionR struct { + Organization *Organization // fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey +} + +func buildFSMosquitoinspectionColumns(alias string) fsMosquitoinspectionColumns { + return fsMosquitoinspectionColumns{ + 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", "updated", + ).WithParent("fs_mosquitoinspection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Actiontaken: psql.Quote(alias, "actiontaken"), + Activity: psql.Quote(alias, "activity"), + Adultact: psql.Quote(alias, "adultact"), + Avetemp: psql.Quote(alias, "avetemp"), + Avglarvae: psql.Quote(alias, "avglarvae"), + Avgpupae: psql.Quote(alias, "avgpupae"), + Breeding: psql.Quote(alias, "breeding"), + Cbcount: psql.Quote(alias, "cbcount"), + Comments: psql.Quote(alias, "comments"), + Containercount: psql.Quote(alias, "containercount"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Domstage: psql.Quote(alias, "domstage"), + Eggs: psql.Quote(alias, "eggs"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldspecies: psql.Quote(alias, "fieldspecies"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvaepresent: psql.Quote(alias, "larvaepresent"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Lstages: psql.Quote(alias, "lstages"), + Numdips: psql.Quote(alias, "numdips"), + Objectid: psql.Quote(alias, "objectid"), + Personalcontact: psql.Quote(alias, "personalcontact"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Posdips: psql.Quote(alias, "posdips"), + Positivecontainercount: psql.Quote(alias, "positivecontainercount"), + Pupaepresent: psql.Quote(alias, "pupaepresent"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sdid: psql.Quote(alias, "sdid"), + Sitecond: psql.Quote(alias, "sitecond"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Tirecount: psql.Quote(alias, "tirecount"), + Totlarvae: psql.Quote(alias, "totlarvae"), + Totpupae: psql.Quote(alias, "totpupae"), + Visualmonitoring: psql.Quote(alias, "visualmonitoring"), + Vmcomments: psql.Quote(alias, "vmcomments"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Adminaction: psql.Quote(alias, "adminaction"), + Ptaid: psql.Quote(alias, "ptaid"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsMosquitoinspectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Actiontaken psql.Expression + Activity psql.Expression + Adultact psql.Expression + Avetemp psql.Expression + Avglarvae psql.Expression + Avgpupae psql.Expression + Breeding psql.Expression + Cbcount psql.Expression + Comments psql.Expression + Containercount psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Domstage psql.Expression + Eggs psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldspecies psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Jurisdiction psql.Expression + Larvaepresent psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Lstages psql.Expression + Numdips psql.Expression + Objectid psql.Expression + Personalcontact psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Posdips psql.Expression + Positivecontainercount psql.Expression + Pupaepresent psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sdid psql.Expression + Sitecond psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Tirecount psql.Expression + Totlarvae psql.Expression + Totpupae psql.Expression + Visualmonitoring psql.Expression + Vmcomments psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Adminaction psql.Expression + Ptaid psql.Expression + Updated psql.Expression +} + +func (c fsMosquitoinspectionColumns) Alias() string { + return c.tableAlias +} + +func (fsMosquitoinspectionColumns) AliasedAs(alias string) fsMosquitoinspectionColumns { + return buildFSMosquitoinspectionColumns(alias) +} + +// FSMosquitoinspectionSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSMosquitoinspectionSetter) SetColumns() []string { + vals := make([]string, 0, 61) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Actiontaken.IsUnset() { + vals = append(vals, "actiontaken") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Adultact.IsUnset() { + vals = append(vals, "adultact") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Avglarvae.IsUnset() { + vals = append(vals, "avglarvae") + } + if !s.Avgpupae.IsUnset() { + vals = append(vals, "avgpupae") + } + if !s.Breeding.IsUnset() { + vals = append(vals, "breeding") + } + if !s.Cbcount.IsUnset() { + vals = append(vals, "cbcount") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Containercount.IsUnset() { + vals = append(vals, "containercount") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Domstage.IsUnset() { + vals = append(vals, "domstage") + } + if !s.Eggs.IsUnset() { + vals = append(vals, "eggs") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldspecies.IsUnset() { + vals = append(vals, "fieldspecies") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvaepresent.IsUnset() { + vals = append(vals, "larvaepresent") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Lstages.IsUnset() { + vals = append(vals, "lstages") + } + if !s.Numdips.IsUnset() { + vals = append(vals, "numdips") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Personalcontact.IsUnset() { + vals = append(vals, "personalcontact") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Posdips.IsUnset() { + vals = append(vals, "posdips") + } + if !s.Positivecontainercount.IsUnset() { + vals = append(vals, "positivecontainercount") + } + if !s.Pupaepresent.IsUnset() { + vals = append(vals, "pupaepresent") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sdid.IsUnset() { + vals = append(vals, "sdid") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Tirecount.IsUnset() { + vals = append(vals, "tirecount") + } + if !s.Totlarvae.IsUnset() { + vals = append(vals, "totlarvae") + } + if !s.Totpupae.IsUnset() { + vals = append(vals, "totpupae") + } + if !s.Visualmonitoring.IsUnset() { + vals = append(vals, "visualmonitoring") + } + if !s.Vmcomments.IsUnset() { + vals = append(vals, "vmcomments") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Adminaction.IsUnset() { + vals = append(vals, "adminaction") + } + if !s.Ptaid.IsUnset() { + vals = append(vals, "ptaid") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSMosquitoinspectionSetter) Overwrite(t *FSMosquitoinspection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Actiontaken.IsUnset() { + t.Actiontaken = s.Actiontaken.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Adultact.IsUnset() { + t.Adultact = s.Adultact.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Avglarvae.IsUnset() { + t.Avglarvae = s.Avglarvae.MustGetNull() + } + if !s.Avgpupae.IsUnset() { + t.Avgpupae = s.Avgpupae.MustGetNull() + } + if !s.Breeding.IsUnset() { + t.Breeding = s.Breeding.MustGetNull() + } + if !s.Cbcount.IsUnset() { + t.Cbcount = s.Cbcount.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Containercount.IsUnset() { + t.Containercount = s.Containercount.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Domstage.IsUnset() { + t.Domstage = s.Domstage.MustGetNull() + } + if !s.Eggs.IsUnset() { + t.Eggs = s.Eggs.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldspecies.IsUnset() { + t.Fieldspecies = s.Fieldspecies.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvaepresent.IsUnset() { + t.Larvaepresent = s.Larvaepresent.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Lstages.IsUnset() { + t.Lstages = s.Lstages.MustGetNull() + } + if !s.Numdips.IsUnset() { + t.Numdips = s.Numdips.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Personalcontact.IsUnset() { + t.Personalcontact = s.Personalcontact.MustGetNull() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Posdips.IsUnset() { + t.Posdips = s.Posdips.MustGetNull() + } + if !s.Positivecontainercount.IsUnset() { + t.Positivecontainercount = s.Positivecontainercount.MustGetNull() + } + if !s.Pupaepresent.IsUnset() { + t.Pupaepresent = s.Pupaepresent.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sdid.IsUnset() { + t.Sdid = s.Sdid.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Tirecount.IsUnset() { + t.Tirecount = s.Tirecount.MustGetNull() + } + if !s.Totlarvae.IsUnset() { + t.Totlarvae = s.Totlarvae.MustGetNull() + } + if !s.Totpupae.IsUnset() { + t.Totpupae = s.Totpupae.MustGetNull() + } + if !s.Visualmonitoring.IsUnset() { + t.Visualmonitoring = s.Visualmonitoring.MustGetNull() + } + if !s.Vmcomments.IsUnset() { + t.Vmcomments = s.Vmcomments.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Adminaction.IsUnset() { + t.Adminaction = s.Adminaction.MustGetNull() + } + if !s.Ptaid.IsUnset() { + t.Ptaid = s.Ptaid.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSMosquitoinspections.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, 61) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Actiontaken.IsUnset() { + vals[1] = psql.Arg(s.Actiontaken.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[2] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Adultact.IsUnset() { + vals[3] = psql.Arg(s.Adultact.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[4] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Avglarvae.IsUnset() { + vals[5] = psql.Arg(s.Avglarvae.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Avgpupae.IsUnset() { + vals[6] = psql.Arg(s.Avgpupae.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Breeding.IsUnset() { + vals[7] = psql.Arg(s.Breeding.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Cbcount.IsUnset() { + vals[8] = psql.Arg(s.Cbcount.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[9] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Containercount.IsUnset() { + vals[10] = psql.Arg(s.Containercount.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[11] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[12] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Domstage.IsUnset() { + vals[13] = psql.Arg(s.Domstage.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Eggs.IsUnset() { + vals[14] = psql.Arg(s.Eggs.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[15] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[16] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[17] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Fieldspecies.IsUnset() { + vals[18] = psql.Arg(s.Fieldspecies.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[19] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[20] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[21] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Larvaepresent.IsUnset() { + vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[23] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[24] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lstages.IsUnset() { + vals[25] = psql.Arg(s.Lstages.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Numdips.IsUnset() { + vals[26] = psql.Arg(s.Numdips.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[27] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Personalcontact.IsUnset() { + vals[28] = psql.Arg(s.Personalcontact.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[29] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[30] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Posdips.IsUnset() { + vals[31] = psql.Arg(s.Posdips.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Positivecontainercount.IsUnset() { + vals[32] = psql.Arg(s.Positivecontainercount.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Pupaepresent.IsUnset() { + vals[33] = psql.Arg(s.Pupaepresent.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[34] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[35] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[36] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[37] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[38] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Sdid.IsUnset() { + vals[39] = psql.Arg(s.Sdid.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[40] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[41] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[42] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Tirecount.IsUnset() { + vals[43] = psql.Arg(s.Tirecount.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Totlarvae.IsUnset() { + vals[44] = psql.Arg(s.Totlarvae.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Totpupae.IsUnset() { + vals[45] = psql.Arg(s.Totpupae.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Visualmonitoring.IsUnset() { + vals[46] = psql.Arg(s.Visualmonitoring.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Vmcomments.IsUnset() { + vals[47] = psql.Arg(s.Vmcomments.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[48] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[49] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[50] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[51] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[52] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[53] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[54] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[55] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[56] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[57] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Adminaction.IsUnset() { + vals[58] = psql.Arg(s.Adminaction.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.Ptaid.IsUnset() { + vals[59] = psql.Arg(s.Ptaid.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[60] = psql.Arg(s.Updated.MustGet()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 61) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Actiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "actiontaken")...), + psql.Arg(s.Actiontaken), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Adultact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adultact")...), + psql.Arg(s.Adultact), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Avglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avglarvae")...), + psql.Arg(s.Avglarvae), + }}) + } + + if !s.Avgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avgpupae")...), + psql.Arg(s.Avgpupae), + }}) + } + + if !s.Breeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "breeding")...), + psql.Arg(s.Breeding), + }}) + } + + if !s.Cbcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cbcount")...), + psql.Arg(s.Cbcount), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Containercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containercount")...), + psql.Arg(s.Containercount), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Domstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "domstage")...), + psql.Arg(s.Domstage), + }}) + } + + if !s.Eggs.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "eggs")...), + psql.Arg(s.Eggs), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldspecies")...), + psql.Arg(s.Fieldspecies), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaepresent")...), + psql.Arg(s.Larvaepresent), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Lstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lstages")...), + psql.Arg(s.Lstages), + }}) + } + + if !s.Numdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "numdips")...), + psql.Arg(s.Numdips), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Personalcontact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "personalcontact")...), + psql.Arg(s.Personalcontact), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Posdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "posdips")...), + psql.Arg(s.Posdips), + }}) + } + + if !s.Positivecontainercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "positivecontainercount")...), + psql.Arg(s.Positivecontainercount), + }}) + } + + if !s.Pupaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pupaepresent")...), + psql.Arg(s.Pupaepresent), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sdid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sdid")...), + psql.Arg(s.Sdid), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Tirecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "tirecount")...), + psql.Arg(s.Tirecount), + }}) + } + + if !s.Totlarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totlarvae")...), + psql.Arg(s.Totlarvae), + }}) + } + + if !s.Totpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totpupae")...), + psql.Arg(s.Totpupae), + }}) + } + + if !s.Visualmonitoring.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "visualmonitoring")...), + psql.Arg(s.Visualmonitoring), + }}) + } + + if !s.Vmcomments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vmcomments")...), + psql.Arg(s.Vmcomments), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Adminaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adminaction")...), + psql.Arg(s.Adminaction), + }}) + } + + if !s.Ptaid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ptaid")...), + psql.Arg(s.Ptaid), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSMosquitoinspection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSMosquitoinspection, error) { + if len(cols) == 0 { + return FSMosquitoinspections.Query( + sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSMosquitoinspections.Query( + sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSMosquitoinspections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSMosquitoinspectionExists checks the presence of a single record by primary key +func FSMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSMosquitoinspections.Query( + sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSMosquitoinspection is retrieved from the database +func (o *FSMosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSMosquitoinspection +func (o *FSMosquitoinspection) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSMosquitoinspection) pkEQ() dialect.Expression { + return psql.Quote("fs_mosquitoinspection", "objectid").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 FSMosquitoinspection +func (o *FSMosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *FSMosquitoinspectionSetter) error { + v, err := FSMosquitoinspections.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 FSMosquitoinspection record with an executor +func (o *FSMosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSMosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSMosquitoinspection using the executor +func (o *FSMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSMosquitoinspections.Query( + sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSMosquitoinspectionSlice is retrieved from the database +func (o FSMosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSMosquitoinspectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_mosquitoinspection", "objectid").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 FSMosquitoinspectionSlice) copyMatchingRows(from ...*FSMosquitoinspection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSMosquitoinspectionSlice) 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 FSMosquitoinspections.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 *FSMosquitoinspection: + o.copyMatchingRows(retrieved) + case []*FSMosquitoinspection: + o.copyMatchingRows(retrieved...) + case FSMosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSMosquitoinspection or a slice of FSMosquitoinspection + // then run the AfterUpdateHooks on the slice + _, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSMosquitoinspectionSlice) 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 FSMosquitoinspections.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 *FSMosquitoinspection: + o.copyMatchingRows(retrieved) + case []*FSMosquitoinspection: + o.copyMatchingRows(retrieved...) + case FSMosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSMosquitoinspection or a slice of FSMosquitoinspection + // then run the AfterDeleteHooks on the slice + _, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSMosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSMosquitoinspectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSMosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSMosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSMosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSMosquitoinspections.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 *FSMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspection0 *FSMosquitoinspection, organization1 *Organization) (*FSMosquitoinspection, error) { + setter := &FSMosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsMosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSMosquitoinspectionOrganization0: %w", err) + } + + return fsMosquitoinspection0, nil +} + +func (fsMosquitoinspection0 *FSMosquitoinspection) 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 = attachFSMosquitoinspectionOrganization0(ctx, exec, 1, fsMosquitoinspection0, organization1) + if err != nil { + return err + } + + fsMosquitoinspection0.R.Organization = organization1 + + organization1.R.FSMosquitoinspections = append(organization1.R.FSMosquitoinspections, fsMosquitoinspection0) + + return nil +} + +func (fsMosquitoinspection0 *FSMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSMosquitoinspectionOrganization0(ctx, exec, 1, fsMosquitoinspection0, organization1) + if err != nil { + return err + } + + fsMosquitoinspection0.R.Organization = organization1 + + organization1.R.FSMosquitoinspections = append(organization1.R.FSMosquitoinspections, fsMosquitoinspection0) + + return nil +} + +type fsMosquitoinspectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Actiontaken psql.WhereNullMod[Q, string] + Activity psql.WhereNullMod[Q, string] + Adultact psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Avglarvae psql.WhereNullMod[Q, float64] + Avgpupae psql.WhereNullMod[Q, float64] + Breeding psql.WhereNullMod[Q, string] + Cbcount psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Containercount psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Domstage psql.WhereNullMod[Q, string] + Eggs psql.WhereNullMod[Q, int16] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldspecies psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Larvaepresent psql.WhereNullMod[Q, int16] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Lstages psql.WhereNullMod[Q, string] + Numdips psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Personalcontact psql.WhereNullMod[Q, int16] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Posdips psql.WhereNullMod[Q, int16] + Positivecontainercount psql.WhereNullMod[Q, int16] + Pupaepresent psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sdid psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Tirecount psql.WhereNullMod[Q, int16] + Totlarvae psql.WhereNullMod[Q, int16] + Totpupae psql.WhereNullMod[Q, int16] + Visualmonitoring psql.WhereNullMod[Q, int16] + Vmcomments psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Adminaction psql.WhereNullMod[Q, string] + Ptaid psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsMosquitoinspectionWhere[Q]) AliasedAs(alias string) fsMosquitoinspectionWhere[Q] { + return buildFSMosquitoinspectionWhere[Q](buildFSMosquitoinspectionColumns(alias)) +} + +func buildFSMosquitoinspectionWhere[Q psql.Filterable](cols fsMosquitoinspectionColumns) fsMosquitoinspectionWhere[Q] { + return fsMosquitoinspectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), + Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae), + Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae), + Breeding: psql.WhereNull[Q, string](cols.Breeding), + Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), + Comments: psql.WhereNull[Q, string](cols.Comments), + Containercount: psql.WhereNull[Q, int16](cols.Containercount), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Domstage: psql.WhereNull[Q, string](cols.Domstage), + Eggs: psql.WhereNull[Q, int16](cols.Eggs), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Lstages: psql.WhereNull[Q, string](cols.Lstages), + Numdips: psql.WhereNull[Q, int16](cols.Numdips), + Objectid: psql.Where[Q, int32](cols.Objectid), + Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Posdips: psql.WhereNull[Q, int16](cols.Posdips), + Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount), + Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sdid: psql.WhereNull[Q, string](cols.Sdid), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), + Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae), + Totpupae: psql.WhereNull[Q, int16](cols.Totpupae), + Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring), + Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Adminaction: psql.WhereNull[Q, string](cols.Adminaction), + Ptaid: psql.WhereNull[Q, string](cols.Ptaid), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSMosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsMosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSMosquitoinspections = FSMosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("fsMosquitoinspection has no relationship %q", name) + } +} + +type fsMosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSMosquitoinspectionPreloader() fsMosquitoinspectionPreloader { + return fsMosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSMosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsMosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSMosquitoinspectionThenLoader[Q orm.Loadable]() fsMosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsMosquitoinspectionThenLoader[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 fsMosquitoinspection's Organization into the .R struct +func (o *FSMosquitoinspection) 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.FSMosquitoinspections = FSMosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsMosquitoinspection's Organization into the .R struct +func (os FSMosquitoinspectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSMosquitoinspections = append(rel.R.FSMosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsMosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsMosquitoinspectionJoins[Q]) aliasedAs(alias string) fsMosquitoinspectionJoins[Q] { + return buildFSMosquitoinspectionJoins[Q](buildFSMosquitoinspectionColumns(alias), j.typ) +} + +func buildFSMosquitoinspectionJoins[Q dialect.Joinable](cols fsMosquitoinspectionColumns, typ string) fsMosquitoinspectionJoins[Q] { + return fsMosquitoinspectionJoins[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_pointlocation.bob.go b/models/fs_pointlocation.bob.go new file mode 100644 index 00000000..5ba71ea6 --- /dev/null +++ b/models/fs_pointlocation.bob.go @@ -0,0 +1,1758 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSPointlocation is an object representing the database table. +type FSPointlocation 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" ` + 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" ` + 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" ` + Stype null.Val[string] `db:"stype" ` + Symbology null.Val[string] `db:"symbology" ` + Usetype null.Val[string] `db:"usetype" ` + Waterorigin null.Val[string] `db:"waterorigin" ` + X null.Val[float64] `db:"x" ` + Y null.Val[float64] `db:"y" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Assignedtech null.Val[string] `db:"assignedtech" ` + DeactivateReason null.Val[string] `db:"deactivate_reason" ` + Scalarpriority null.Val[int64] `db:"scalarpriority" ` + Sourcestatus null.Val[string] `db:"sourcestatus" ` + Updated time.Time `db:"updated" ` + + R fsPointlocationR `db:"-" ` +} + +// FSPointlocationSlice is an alias for a slice of pointers to FSPointlocation. +// This should almost always be used instead of []*FSPointlocation. +type FSPointlocationSlice []*FSPointlocation + +// FSPointlocations contains methods to work with the fs_pointlocation table +var FSPointlocations = psql.NewTablex[*FSPointlocation, FSPointlocationSlice, *FSPointlocationSetter]("", "fs_pointlocation", buildFSPointlocationColumns("fs_pointlocation")) + +// FSPointlocationsQuery is a query on the fs_pointlocation table +type FSPointlocationsQuery = *psql.ViewQuery[*FSPointlocation, FSPointlocationSlice] + +// fsPointlocationR is where relationships are stored. +type fsPointlocationR struct { + Organization *Organization // fs_pointlocation.fs_pointlocation_organization_id_fkey +} + +func buildFSPointlocationColumns(alias string) fsPointlocationColumns { + return fsPointlocationColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "stype", "symbology", "usetype", "waterorigin", "x", "y", "zone", "zone2", "geometry_x", "geometry_y", "assignedtech", "deactivate_reason", "scalarpriority", "sourcestatus", "updated", + ).WithParent("fs_pointlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Stype: psql.Quote(alias, "stype"), + Symbology: psql.Quote(alias, "symbology"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + X: psql.Quote(alias, "x"), + Y: psql.Quote(alias, "y"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Assignedtech: psql.Quote(alias, "assignedtech"), + DeactivateReason: psql.Quote(alias, "deactivate_reason"), + Scalarpriority: psql.Quote(alias, "scalarpriority"), + Sourcestatus: psql.Quote(alias, "sourcestatus"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsPointlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Stype psql.Expression + Symbology psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + X psql.Expression + Y psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Assignedtech psql.Expression + DeactivateReason psql.Expression + Scalarpriority psql.Expression + Sourcestatus psql.Expression + Updated psql.Expression +} + +func (c fsPointlocationColumns) Alias() string { + return c.tableAlias +} + +func (fsPointlocationColumns) AliasedAs(alias string) fsPointlocationColumns { + return buildFSPointlocationColumns(alias) +} + +// FSPointlocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + 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" ` + 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" ` + Stype omitnull.Val[string] `db:"stype" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + X omitnull.Val[float64] `db:"x" ` + Y omitnull.Val[float64] `db:"y" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + DeactivateReason omitnull.Val[string] `db:"deactivate_reason" ` + Scalarpriority omitnull.Val[int64] `db:"scalarpriority" ` + Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSPointlocationSetter) SetColumns() []string { + vals := make([]string, 0, 48) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Stype.IsUnset() { + vals = append(vals, "stype") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.X.IsUnset() { + vals = append(vals, "x") + } + if !s.Y.IsUnset() { + vals = append(vals, "y") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.Assignedtech.IsUnset() { + vals = append(vals, "assignedtech") + } + if !s.DeactivateReason.IsUnset() { + vals = append(vals, "deactivate_reason") + } + if !s.Scalarpriority.IsUnset() { + vals = append(vals, "scalarpriority") + } + if !s.Sourcestatus.IsUnset() { + vals = append(vals, "sourcestatus") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSPointlocationSetter) Overwrite(t *FSPointlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Stype.IsUnset() { + t.Stype = s.Stype.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.X.IsUnset() { + t.X = s.X.MustGetNull() + } + if !s.Y.IsUnset() { + t.Y = s.Y.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.Assignedtech.IsUnset() { + t.Assignedtech = s.Assignedtech.MustGetNull() + } + if !s.DeactivateReason.IsUnset() { + t.DeactivateReason = s.DeactivateReason.MustGetNull() + } + if !s.Scalarpriority.IsUnset() { + t.Scalarpriority = s.Scalarpriority.MustGetNull() + } + if !s.Sourcestatus.IsUnset() { + t.Sourcestatus = s.Sourcestatus.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSPointlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSPointlocations.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, 48) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[10] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[11] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[12] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[13] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[14] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[15] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[23] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[24] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[25] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[28] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[29] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[30] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[31] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[32] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Stype.IsUnset() { + vals[33] = psql.Arg(s.Stype.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[34] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[35] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[36] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.X.IsUnset() { + vals[37] = psql.Arg(s.X.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Y.IsUnset() { + vals[38] = psql.Arg(s.Y.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[39] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[40] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[41] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[42] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Assignedtech.IsUnset() { + vals[43] = psql.Arg(s.Assignedtech.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.DeactivateReason.IsUnset() { + vals[44] = psql.Arg(s.DeactivateReason.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Scalarpriority.IsUnset() { + vals[45] = psql.Arg(s.Scalarpriority.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Sourcestatus.IsUnset() { + vals[46] = psql.Arg(s.Sourcestatus.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[47] = psql.Arg(s.Updated.MustGet()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSPointlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 48) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Stype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "stype")...), + psql.Arg(s.Stype), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.X.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "x")...), + psql.Arg(s.X), + }}) + } + + if !s.Y.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "y")...), + psql.Arg(s.Y), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.Assignedtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "assignedtech")...), + psql.Arg(s.Assignedtech), + }}) + } + + if !s.DeactivateReason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deactivate_reason")...), + psql.Arg(s.DeactivateReason), + }}) + } + + if !s.Scalarpriority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scalarpriority")...), + psql.Arg(s.Scalarpriority), + }}) + } + + if !s.Sourcestatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sourcestatus")...), + psql.Arg(s.Sourcestatus), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSPointlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSPointlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPointlocation, error) { + if len(cols) == 0 { + return FSPointlocations.Query( + sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSPointlocations.Query( + sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSPointlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSPointlocationExists checks the presence of a single record by primary key +func FSPointlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSPointlocations.Query( + sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSPointlocation is retrieved from the database +func (o *FSPointlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPointlocations.AfterSelectHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSPointlocations.AfterInsertHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSPointlocation +func (o *FSPointlocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSPointlocation) pkEQ() dialect.Expression { + return psql.Quote("fs_pointlocation", "objectid").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 FSPointlocation +func (o *FSPointlocation) Update(ctx context.Context, exec bob.Executor, s *FSPointlocationSetter) error { + v, err := FSPointlocations.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 FSPointlocation record with an executor +func (o *FSPointlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSPointlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSPointlocation using the executor +func (o *FSPointlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSPointlocations.Query( + sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSPointlocationSlice is retrieved from the database +func (o FSPointlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPointlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSPointlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSPointlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_pointlocation", "objectid").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 FSPointlocationSlice) copyMatchingRows(from ...*FSPointlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSPointlocationSlice) 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 FSPointlocations.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 *FSPointlocation: + o.copyMatchingRows(retrieved) + case []*FSPointlocation: + o.copyMatchingRows(retrieved...) + case FSPointlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPointlocation or a slice of FSPointlocation + // then run the AfterUpdateHooks on the slice + _, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSPointlocationSlice) 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 FSPointlocations.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 *FSPointlocation: + o.copyMatchingRows(retrieved) + case []*FSPointlocation: + o.copyMatchingRows(retrieved...) + case FSPointlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPointlocation or a slice of FSPointlocation + // then run the AfterDeleteHooks on the slice + _, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSPointlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPointlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSPointlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSPointlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSPointlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSPointlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSPointlocations.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 *FSPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSPointlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPointlocation0 *FSPointlocation, organization1 *Organization) (*FSPointlocation, error) { + setter := &FSPointlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsPointlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSPointlocationOrganization0: %w", err) + } + + return fsPointlocation0, nil +} + +func (fsPointlocation0 *FSPointlocation) 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 = attachFSPointlocationOrganization0(ctx, exec, 1, fsPointlocation0, organization1) + if err != nil { + return err + } + + fsPointlocation0.R.Organization = organization1 + + organization1.R.FSPointlocations = append(organization1.R.FSPointlocations, fsPointlocation0) + + return nil +} + +func (fsPointlocation0 *FSPointlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSPointlocationOrganization0(ctx, exec, 1, fsPointlocation0, organization1) + if err != nil { + return err + } + + fsPointlocation0.R.Organization = organization1 + + organization1.R.FSPointlocations = append(organization1.R.FSPointlocations, fsPointlocation0) + + return nil +} + +type fsPointlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Stype psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + X psql.WhereNullMod[Q, float64] + Y psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Assignedtech psql.WhereNullMod[Q, string] + DeactivateReason psql.WhereNullMod[Q, string] + Scalarpriority psql.WhereNullMod[Q, int64] + Sourcestatus psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsPointlocationWhere[Q]) AliasedAs(alias string) fsPointlocationWhere[Q] { + return buildFSPointlocationWhere[Q](buildFSPointlocationColumns(alias)) +} + +func buildFSPointlocationWhere[Q psql.Filterable](cols fsPointlocationColumns) fsPointlocationWhere[Q] { + return fsPointlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Stype: psql.WhereNull[Q, string](cols.Stype), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + X: psql.WhereNull[Q, float64](cols.X), + Y: psql.WhereNull[Q, float64](cols.Y), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), + DeactivateReason: psql.WhereNull[Q, string](cols.DeactivateReason), + Scalarpriority: psql.WhereNull[Q, int64](cols.Scalarpriority), + Sourcestatus: psql.WhereNull[Q, string](cols.Sourcestatus), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSPointlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsPointlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSPointlocations = FSPointlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsPointlocation has no relationship %q", name) + } +} + +type fsPointlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSPointlocationPreloader() fsPointlocationPreloader { + return fsPointlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSPointlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsPointlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSPointlocationThenLoader[Q orm.Loadable]() fsPointlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsPointlocationThenLoader[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 fsPointlocation's Organization into the .R struct +func (o *FSPointlocation) 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.FSPointlocations = FSPointlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsPointlocation's Organization into the .R struct +func (os FSPointlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSPointlocations = append(rel.R.FSPointlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsPointlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsPointlocationJoins[Q]) aliasedAs(alias string) fsPointlocationJoins[Q] { + return buildFSPointlocationJoins[Q](buildFSPointlocationColumns(alias), j.typ) +} + +func buildFSPointlocationJoins[Q dialect.Joinable](cols fsPointlocationColumns, typ string) fsPointlocationJoins[Q] { + return fsPointlocationJoins[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_polygonlocation.bob.go b/models/fs_polygonlocation.bob.go new file mode 100644 index 00000000..55c8b332 --- /dev/null +++ b/models/fs_polygonlocation.bob.go @@ -0,0 +1,1708 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSPolygonlocation is an object representing the database table. +type FSPolygonlocation 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" ` + Filter null.Val[string] `db:"filter" ` + 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" ` + 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" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Usetype null.Val[string] `db:"usetype" ` + Waterorigin null.Val[string] `db:"waterorigin" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Updated time.Time `db:"updated" ` + + R fsPolygonlocationR `db:"-" ` +} + +// FSPolygonlocationSlice is an alias for a slice of pointers to FSPolygonlocation. +// This should almost always be used instead of []*FSPolygonlocation. +type FSPolygonlocationSlice []*FSPolygonlocation + +// FSPolygonlocations contains methods to work with the fs_polygonlocation table +var FSPolygonlocations = psql.NewTablex[*FSPolygonlocation, FSPolygonlocationSlice, *FSPolygonlocationSetter]("", "fs_polygonlocation", buildFSPolygonlocationColumns("fs_polygonlocation")) + +// FSPolygonlocationsQuery is a query on the fs_polygonlocation table +type FSPolygonlocationsQuery = *psql.ViewQuery[*FSPolygonlocation, FSPolygonlocationSlice] + +// fsPolygonlocationR is where relationships are stored. +type fsPolygonlocationR struct { + Organization *Organization // fs_polygonlocation.fs_polygonlocation_organization_id_fkey +} + +func buildFSPolygonlocationColumns(alias string) fsPolygonlocationColumns { + return fsPolygonlocationColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "filter", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__area", "shape__length", "usetype", "waterorigin", "zone", "zone2", "geometry_x", "geometry_y", "updated", + ).WithParent("fs_polygonlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Acres: psql.Quote(alias, "acres"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Filter: psql.Quote(alias, "filter"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Hectares: psql.Quote(alias, "hectares"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsPolygonlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Acres psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Filter psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Hectares psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Updated psql.Expression +} + +func (c fsPolygonlocationColumns) Alias() string { + return c.tableAlias +} + +func (fsPolygonlocationColumns) AliasedAs(alias string) fsPolygonlocationColumns { + return buildFSPolygonlocationColumns(alias) +} + +// FSPolygonlocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Filter omitnull.Val[string] `db:"filter" ` + 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" ` + 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" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSPolygonlocationSetter) SetColumns() []string { + vals := make([]string, 0, 46) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Filter.IsUnset() { + vals = append(vals, "filter") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSPolygonlocationSetter) Overwrite(t *FSPolygonlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Filter.IsUnset() { + t.Filter = s.Filter.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSPolygonlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSPolygonlocations.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, 46) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[2] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[3] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[7] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[8] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[9] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[10] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Filter.IsUnset() { + vals[11] = psql.Arg(s.Filter.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[12] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[13] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[14] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[15] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[16] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[23] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[24] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[25] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[28] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[29] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[30] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[31] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[32] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[33] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[34] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[35] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[36] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[37] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[39] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[41] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[42] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[43] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[44] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[45] = psql.Arg(s.Updated.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 46) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Filter.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "filter")...), + psql.Arg(s.Filter), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSPolygonlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPolygonlocation, error) { + if len(cols) == 0 { + return FSPolygonlocations.Query( + sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSPolygonlocations.Query( + sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSPolygonlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSPolygonlocationExists checks the presence of a single record by primary key +func FSPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSPolygonlocations.Query( + sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSPolygonlocation is retrieved from the database +func (o *FSPolygonlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSPolygonlocation +func (o *FSPolygonlocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSPolygonlocation) pkEQ() dialect.Expression { + return psql.Quote("fs_polygonlocation", "objectid").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 FSPolygonlocation +func (o *FSPolygonlocation) Update(ctx context.Context, exec bob.Executor, s *FSPolygonlocationSetter) error { + v, err := FSPolygonlocations.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 FSPolygonlocation record with an executor +func (o *FSPolygonlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSPolygonlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSPolygonlocation using the executor +func (o *FSPolygonlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSPolygonlocations.Query( + sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSPolygonlocationSlice is retrieved from the database +func (o FSPolygonlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSPolygonlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_polygonlocation", "objectid").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 FSPolygonlocationSlice) copyMatchingRows(from ...*FSPolygonlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSPolygonlocationSlice) 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 FSPolygonlocations.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 *FSPolygonlocation: + o.copyMatchingRows(retrieved) + case []*FSPolygonlocation: + o.copyMatchingRows(retrieved...) + case FSPolygonlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPolygonlocation or a slice of FSPolygonlocation + // then run the AfterUpdateHooks on the slice + _, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSPolygonlocationSlice) 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 FSPolygonlocations.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 *FSPolygonlocation: + o.copyMatchingRows(retrieved) + case []*FSPolygonlocation: + o.copyMatchingRows(retrieved...) + case FSPolygonlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPolygonlocation or a slice of FSPolygonlocation + // then run the AfterDeleteHooks on the slice + _, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSPolygonlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPolygonlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSPolygonlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSPolygonlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSPolygonlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSPolygonlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSPolygonlocations.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 *FSPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocation0 *FSPolygonlocation, organization1 *Organization) (*FSPolygonlocation, error) { + setter := &FSPolygonlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsPolygonlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSPolygonlocationOrganization0: %w", err) + } + + return fsPolygonlocation0, nil +} + +func (fsPolygonlocation0 *FSPolygonlocation) 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 = attachFSPolygonlocationOrganization0(ctx, exec, 1, fsPolygonlocation0, organization1) + if err != nil { + return err + } + + fsPolygonlocation0.R.Organization = organization1 + + organization1.R.FSPolygonlocations = append(organization1.R.FSPolygonlocations, fsPolygonlocation0) + + return nil +} + +func (fsPolygonlocation0 *FSPolygonlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSPolygonlocationOrganization0(ctx, exec, 1, fsPolygonlocation0, organization1) + if err != nil { + return err + } + + fsPolygonlocation0.R.Organization = organization1 + + organization1.R.FSPolygonlocations = append(organization1.R.FSPolygonlocations, fsPolygonlocation0) + + return nil +} + +type fsPolygonlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Acres psql.WhereNullMod[Q, float64] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Filter psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsPolygonlocationWhere[Q]) AliasedAs(alias string) fsPolygonlocationWhere[Q] { + return buildFSPolygonlocationWhere[Q](buildFSPolygonlocationColumns(alias)) +} + +func buildFSPolygonlocationWhere[Q psql.Filterable](cols fsPolygonlocationColumns) fsPolygonlocationWhere[Q] { + return fsPolygonlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Filter: psql.WhereNull[Q, string](cols.Filter), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSPolygonlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsPolygonlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSPolygonlocations = FSPolygonlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsPolygonlocation has no relationship %q", name) + } +} + +type fsPolygonlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSPolygonlocationPreloader() fsPolygonlocationPreloader { + return fsPolygonlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSPolygonlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsPolygonlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSPolygonlocationThenLoader[Q orm.Loadable]() fsPolygonlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsPolygonlocationThenLoader[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 fsPolygonlocation's Organization into the .R struct +func (o *FSPolygonlocation) 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.FSPolygonlocations = FSPolygonlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsPolygonlocation's Organization into the .R struct +func (os FSPolygonlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSPolygonlocations = append(rel.R.FSPolygonlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsPolygonlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsPolygonlocationJoins[Q]) aliasedAs(alias string) fsPolygonlocationJoins[Q] { + return buildFSPolygonlocationJoins[Q](buildFSPolygonlocationColumns(alias), j.typ) +} + +func buildFSPolygonlocationJoins[Q dialect.Joinable](cols fsPolygonlocationColumns, typ string) fsPolygonlocationJoins[Q] { + return fsPolygonlocationJoins[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_pool.bob.go b/models/fs_pool.bob.go new file mode 100644 index 00000000..4813495f --- /dev/null +++ b/models/fs_pool.bob.go @@ -0,0 +1,1358 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSPool is an object representing the database table. +type FSPool 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" ` + Updated time.Time `db:"updated" ` + + R fsPoolR `db:"-" ` +} + +// FSPoolSlice is an alias for a slice of pointers to FSPool. +// This should almost always be used instead of []*FSPool. +type FSPoolSlice []*FSPool + +// FSPools contains methods to work with the fs_pool table +var FSPools = psql.NewTablex[*FSPool, FSPoolSlice, *FSPoolSetter]("", "fs_pool", buildFSPoolColumns("fs_pool")) + +// FSPoolsQuery is a query on the fs_pool table +type FSPoolsQuery = *psql.ViewQuery[*FSPool, FSPoolSlice] + +// fsPoolR is where relationships are stored. +type fsPoolR struct { + Organization *Organization // fs_pool.fs_pool_organization_id_fkey +} + +func buildFSPoolColumns(alias string) fsPoolColumns { + return fsPoolColumns{ + 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", "updated", + ).WithParent("fs_pool"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datesent: psql.Quote(alias, "datesent"), + Datetested: psql.Quote(alias, "datetested"), + Diseasepos: psql.Quote(alias, "diseasepos"), + Diseasetested: psql.Quote(alias, "diseasetested"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Lab: psql.Quote(alias, "lab"), + LabID: psql.Quote(alias, "lab_id"), + Objectid: psql.Quote(alias, "objectid"), + Poolyear: psql.Quote(alias, "poolyear"), + Processed: psql.Quote(alias, "processed"), + Sampleid: psql.Quote(alias, "sampleid"), + Survtech: psql.Quote(alias, "survtech"), + Testmethod: psql.Quote(alias, "testmethod"), + Testtech: psql.Quote(alias, "testtech"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Vectorsurvcollectionid: psql.Quote(alias, "vectorsurvcollectionid"), + Vectorsurvpoolid: psql.Quote(alias, "vectorsurvpoolid"), + Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsPoolColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datesent psql.Expression + Datetested psql.Expression + Diseasepos psql.Expression + Diseasetested psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Lab psql.Expression + LabID psql.Expression + Objectid psql.Expression + Poolyear psql.Expression + Processed psql.Expression + Sampleid psql.Expression + Survtech psql.Expression + Testmethod psql.Expression + Testtech psql.Expression + TrapdataID psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Vectorsurvcollectionid psql.Expression + Vectorsurvpoolid psql.Expression + Vectorsurvtrapdataid psql.Expression + Updated psql.Expression +} + +func (c fsPoolColumns) Alias() string { + return c.tableAlias +} + +func (fsPoolColumns) AliasedAs(alias string) fsPoolColumns { + return buildFSPoolColumns(alias) +} + +// FSPoolSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSPoolSetter) SetColumns() []string { + vals := make([]string, 0, 32) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datesent.IsUnset() { + vals = append(vals, "datesent") + } + if !s.Datetested.IsUnset() { + vals = append(vals, "datetested") + } + if !s.Diseasepos.IsUnset() { + vals = append(vals, "diseasepos") + } + if !s.Diseasetested.IsUnset() { + vals = append(vals, "diseasetested") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lab.IsUnset() { + vals = append(vals, "lab") + } + if !s.LabID.IsUnset() { + vals = append(vals, "lab_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Poolyear.IsUnset() { + vals = append(vals, "poolyear") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.Survtech.IsUnset() { + vals = append(vals, "survtech") + } + if !s.Testmethod.IsUnset() { + vals = append(vals, "testmethod") + } + if !s.Testtech.IsUnset() { + vals = append(vals, "testtech") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Vectorsurvcollectionid.IsUnset() { + vals = append(vals, "vectorsurvcollectionid") + } + if !s.Vectorsurvpoolid.IsUnset() { + vals = append(vals, "vectorsurvpoolid") + } + if !s.Vectorsurvtrapdataid.IsUnset() { + vals = append(vals, "vectorsurvtrapdataid") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSPoolSetter) Overwrite(t *FSPool) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datesent.IsUnset() { + t.Datesent = s.Datesent.MustGetNull() + } + if !s.Datetested.IsUnset() { + t.Datetested = s.Datetested.MustGetNull() + } + if !s.Diseasepos.IsUnset() { + t.Diseasepos = s.Diseasepos.MustGetNull() + } + if !s.Diseasetested.IsUnset() { + t.Diseasetested = s.Diseasetested.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lab.IsUnset() { + t.Lab = s.Lab.MustGetNull() + } + if !s.LabID.IsUnset() { + t.LabID = s.LabID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Poolyear.IsUnset() { + t.Poolyear = s.Poolyear.MustGetNull() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.Survtech.IsUnset() { + t.Survtech = s.Survtech.MustGetNull() + } + if !s.Testmethod.IsUnset() { + t.Testmethod = s.Testmethod.MustGetNull() + } + if !s.Testtech.IsUnset() { + t.Testtech = s.Testtech.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Vectorsurvcollectionid.IsUnset() { + t.Vectorsurvcollectionid = s.Vectorsurvcollectionid.MustGetNull() + } + if !s.Vectorsurvpoolid.IsUnset() { + t.Vectorsurvpoolid = s.Vectorsurvpoolid.MustGetNull() + } + if !s.Vectorsurvtrapdataid.IsUnset() { + t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSPoolSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSPools.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, 32) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Datesent.IsUnset() { + vals[4] = psql.Arg(s.Datesent.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Datetested.IsUnset() { + vals[5] = psql.Arg(s.Datetested.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Diseasepos.IsUnset() { + vals[6] = psql.Arg(s.Diseasepos.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Diseasetested.IsUnset() { + vals[7] = psql.Arg(s.Diseasetested.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lab.IsUnset() { + vals[12] = psql.Arg(s.Lab.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LabID.IsUnset() { + vals[13] = psql.Arg(s.LabID.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[14] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Poolyear.IsUnset() { + vals[15] = psql.Arg(s.Poolyear.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[16] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[17] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Survtech.IsUnset() { + vals[18] = psql.Arg(s.Survtech.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Testmethod.IsUnset() { + vals[19] = psql.Arg(s.Testmethod.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Testtech.IsUnset() { + vals[20] = psql.Arg(s.Testtech.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[21] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvcollectionid.IsUnset() { + vals[28] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvpoolid.IsUnset() { + vals[29] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[30] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[31] = psql.Arg(s.Updated.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSPoolSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 32) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datesent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datesent")...), + psql.Arg(s.Datesent), + }}) + } + + if !s.Datetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetested")...), + psql.Arg(s.Datetested), + }}) + } + + if !s.Diseasepos.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasepos")...), + psql.Arg(s.Diseasepos), + }}) + } + + if !s.Diseasetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasetested")...), + psql.Arg(s.Diseasetested), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lab.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab")...), + psql.Arg(s.Lab), + }}) + } + + if !s.LabID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab_id")...), + psql.Arg(s.LabID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Poolyear.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "poolyear")...), + psql.Arg(s.Poolyear), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.Survtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "survtech")...), + psql.Arg(s.Survtech), + }}) + } + + if !s.Testmethod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testmethod")...), + psql.Arg(s.Testmethod), + }}) + } + + if !s.Testtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testtech")...), + psql.Arg(s.Testtech), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Vectorsurvcollectionid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvcollectionid")...), + psql.Arg(s.Vectorsurvcollectionid), + }}) + } + + if !s.Vectorsurvpoolid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvpoolid")...), + psql.Arg(s.Vectorsurvpoolid), + }}) + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtrapdataid")...), + psql.Arg(s.Vectorsurvtrapdataid), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSPool retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSPool(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPool, error) { + if len(cols) == 0 { + return FSPools.Query( + sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSPools.Query( + sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSPools.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSPoolExists checks the presence of a single record by primary key +func FSPoolExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSPools.Query( + sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSPool is retrieved from the database +func (o *FSPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPools.AfterSelectHooks.RunHooks(ctx, exec, FSPoolSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSPools.AfterInsertHooks.RunHooks(ctx, exec, FSPoolSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, FSPoolSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, FSPoolSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSPool +func (o *FSPool) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSPool) pkEQ() dialect.Expression { + return psql.Quote("fs_pool", "objectid").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 FSPool +func (o *FSPool) Update(ctx context.Context, exec bob.Executor, s *FSPoolSetter) error { + v, err := FSPools.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 FSPool record with an executor +func (o *FSPool) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSPools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSPool using the executor +func (o *FSPool) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSPools.Query( + sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSPoolSlice is retrieved from the database +func (o FSPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPools.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSPools.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSPoolSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_pool", "objectid").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 FSPoolSlice) copyMatchingRows(from ...*FSPool) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSPoolSlice) 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 FSPools.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 *FSPool: + o.copyMatchingRows(retrieved) + case []*FSPool: + o.copyMatchingRows(retrieved...) + case FSPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPool or a slice of FSPool + // then run the AfterUpdateHooks on the slice + _, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSPoolSlice) 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 FSPools.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 *FSPool: + o.copyMatchingRows(retrieved) + case []*FSPool: + o.copyMatchingRows(retrieved...) + case FSPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPool or a slice of FSPool + // then run the AfterDeleteHooks on the slice + _, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSPoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPoolSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSPools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSPoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSPools.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSPools.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 *FSPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSPoolOrganization0(ctx context.Context, exec bob.Executor, count int, fsPool0 *FSPool, organization1 *Organization) (*FSPool, error) { + setter := &FSPoolSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsPool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSPoolOrganization0: %w", err) + } + + return fsPool0, nil +} + +func (fsPool0 *FSPool) 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 = attachFSPoolOrganization0(ctx, exec, 1, fsPool0, organization1) + if err != nil { + return err + } + + fsPool0.R.Organization = organization1 + + organization1.R.FSPools = append(organization1.R.FSPools, fsPool0) + + return nil +} + +func (fsPool0 *FSPool) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSPoolOrganization0(ctx, exec, 1, fsPool0, organization1) + if err != nil { + return err + } + + fsPool0.R.Organization = organization1 + + organization1.R.FSPools = append(organization1.R.FSPools, fsPool0) + + return nil +} + +type fsPoolWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datesent psql.WhereNullMod[Q, int64] + Datetested psql.WhereNullMod[Q, int64] + Diseasepos psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Lab psql.WhereNullMod[Q, string] + LabID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Poolyear psql.WhereNullMod[Q, int16] + Processed psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + Survtech psql.WhereNullMod[Q, string] + Testmethod psql.WhereNullMod[Q, string] + Testtech psql.WhereNullMod[Q, string] + TrapdataID psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Vectorsurvcollectionid psql.WhereNullMod[Q, string] + Vectorsurvpoolid psql.WhereNullMod[Q, string] + Vectorsurvtrapdataid psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsPoolWhere[Q]) AliasedAs(alias string) fsPoolWhere[Q] { + return buildFSPoolWhere[Q](buildFSPoolColumns(alias)) +} + +func buildFSPoolWhere[Q psql.Filterable](cols fsPoolColumns) fsPoolWhere[Q] { + return fsPoolWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Datesent: psql.WhereNull[Q, int64](cols.Datesent), + Datetested: psql.WhereNull[Q, int64](cols.Datetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lab: psql.WhereNull[Q, string](cols.Lab), + LabID: psql.WhereNull[Q, string](cols.LabID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Poolyear: psql.WhereNull[Q, int16](cols.Poolyear), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + Survtech: psql.WhereNull[Q, string](cols.Survtech), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Testtech: psql.WhereNull[Q, string](cols.Testtech), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Vectorsurvcollectionid: psql.WhereNull[Q, string](cols.Vectorsurvcollectionid), + Vectorsurvpoolid: psql.WhereNull[Q, string](cols.Vectorsurvpoolid), + Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSPool) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsPool cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSPools = FSPoolSlice{o} + } + return nil + default: + return fmt.Errorf("fsPool has no relationship %q", name) + } +} + +type fsPoolPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSPoolPreloader() fsPoolPreloader { + return fsPoolPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSPools, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsPoolThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSPoolThenLoader[Q orm.Loadable]() fsPoolThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsPoolThenLoader[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 fsPool's Organization into the .R struct +func (o *FSPool) 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.FSPools = FSPoolSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsPool's Organization into the .R struct +func (os FSPoolSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSPools = append(rel.R.FSPools, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsPoolJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsPoolJoins[Q]) aliasedAs(alias string) fsPoolJoins[Q] { + return buildFSPoolJoins[Q](buildFSPoolColumns(alias), j.typ) +} + +func buildFSPoolJoins[Q dialect.Joinable](cols fsPoolColumns, typ string) fsPoolJoins[Q] { + return fsPoolJoins[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_pooldetail.bob.go b/models/fs_pooldetail.bob.go new file mode 100644 index 00000000..2051b6b9 --- /dev/null +++ b/models/fs_pooldetail.bob.go @@ -0,0 +1,1008 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSPooldetail is an object representing the database table. +type FSPooldetail 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" ` + Updated time.Time `db:"updated" ` + + R fsPooldetailR `db:"-" ` +} + +// FSPooldetailSlice is an alias for a slice of pointers to FSPooldetail. +// This should almost always be used instead of []*FSPooldetail. +type FSPooldetailSlice []*FSPooldetail + +// FSPooldetails contains methods to work with the fs_pooldetail table +var FSPooldetails = psql.NewTablex[*FSPooldetail, FSPooldetailSlice, *FSPooldetailSetter]("", "fs_pooldetail", buildFSPooldetailColumns("fs_pooldetail")) + +// FSPooldetailsQuery is a query on the fs_pooldetail table +type FSPooldetailsQuery = *psql.ViewQuery[*FSPooldetail, FSPooldetailSlice] + +// fsPooldetailR is where relationships are stored. +type fsPooldetailR struct { + Organization *Organization // fs_pooldetail.fs_pooldetail_organization_id_fkey +} + +func buildFSPooldetailColumns(alias string) fsPooldetailColumns { + return fsPooldetailColumns{ + 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", "updated", + ).WithParent("fs_pooldetail"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Females: psql.Quote(alias, "females"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + PoolID: psql.Quote(alias, "pool_id"), + Species: psql.Quote(alias, "species"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsPooldetailColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Females psql.Expression + Globalid psql.Expression + Objectid psql.Expression + PoolID psql.Expression + Species psql.Expression + TrapdataID psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsPooldetailColumns) Alias() string { + return c.tableAlias +} + +func (fsPooldetailColumns) AliasedAs(alias string) fsPooldetailColumns { + return buildFSPooldetailColumns(alias) +} + +// FSPooldetailSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSPooldetailSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Females.IsUnset() { + vals = append(vals, "females") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.PoolID.IsUnset() { + vals = append(vals, "pool_id") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSPooldetailSetter) Overwrite(t *FSPooldetail) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Females.IsUnset() { + t.Females = s.Females.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.PoolID.IsUnset() { + t.PoolID = s.PoolID.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSPooldetailSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSPooldetails.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Females.IsUnset() { + vals[5] = psql.Arg(s.Females.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[7] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.PoolID.IsUnset() { + vals[8] = psql.Arg(s.PoolID.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[9] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[10] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[17] = psql.Arg(s.Updated.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSPooldetailSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Females.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "females")...), + psql.Arg(s.Females), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.PoolID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pool_id")...), + psql.Arg(s.PoolID), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSPooldetail retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPooldetail, error) { + if len(cols) == 0 { + return FSPooldetails.Query( + sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSPooldetails.Query( + sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSPooldetails.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSPooldetailExists checks the presence of a single record by primary key +func FSPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSPooldetails.Query( + sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSPooldetail is retrieved from the database +func (o *FSPooldetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPooldetails.AfterSelectHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSPooldetails.AfterInsertHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSPooldetail +func (o *FSPooldetail) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSPooldetail) pkEQ() dialect.Expression { + return psql.Quote("fs_pooldetail", "objectid").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 FSPooldetail +func (o *FSPooldetail) Update(ctx context.Context, exec bob.Executor, s *FSPooldetailSetter) error { + v, err := FSPooldetails.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 FSPooldetail record with an executor +func (o *FSPooldetail) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSPooldetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSPooldetail using the executor +func (o *FSPooldetail) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSPooldetails.Query( + sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSPooldetailSlice is retrieved from the database +func (o FSPooldetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSPooldetails.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSPooldetails.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSPooldetailSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_pooldetail", "objectid").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 FSPooldetailSlice) copyMatchingRows(from ...*FSPooldetail) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSPooldetailSlice) 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 FSPooldetails.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 *FSPooldetail: + o.copyMatchingRows(retrieved) + case []*FSPooldetail: + o.copyMatchingRows(retrieved...) + case FSPooldetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPooldetail or a slice of FSPooldetail + // then run the AfterUpdateHooks on the slice + _, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSPooldetailSlice) 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 FSPooldetails.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 *FSPooldetail: + o.copyMatchingRows(retrieved) + case []*FSPooldetail: + o.copyMatchingRows(retrieved...) + case FSPooldetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSPooldetail or a slice of FSPooldetail + // then run the AfterDeleteHooks on the slice + _, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSPooldetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPooldetailSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSPooldetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSPooldetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSPooldetails.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSPooldetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSPooldetails.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 *FSPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsPooldetail0 *FSPooldetail, organization1 *Organization) (*FSPooldetail, error) { + setter := &FSPooldetailSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsPooldetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSPooldetailOrganization0: %w", err) + } + + return fsPooldetail0, nil +} + +func (fsPooldetail0 *FSPooldetail) 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 = attachFSPooldetailOrganization0(ctx, exec, 1, fsPooldetail0, organization1) + if err != nil { + return err + } + + fsPooldetail0.R.Organization = organization1 + + organization1.R.FSPooldetails = append(organization1.R.FSPooldetails, fsPooldetail0) + + return nil +} + +func (fsPooldetail0 *FSPooldetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSPooldetailOrganization0(ctx, exec, 1, fsPooldetail0, organization1) + if err != nil { + return err + } + + fsPooldetail0.R.Organization = organization1 + + organization1.R.FSPooldetails = append(organization1.R.FSPooldetails, fsPooldetail0) + + return nil +} + +type fsPooldetailWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Females psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + PoolID psql.WhereNullMod[Q, string] + Species psql.WhereNullMod[Q, string] + TrapdataID psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsPooldetailWhere[Q]) AliasedAs(alias string) fsPooldetailWhere[Q] { + return buildFSPooldetailWhere[Q](buildFSPooldetailColumns(alias)) +} + +func buildFSPooldetailWhere[Q psql.Filterable](cols fsPooldetailColumns) fsPooldetailWhere[Q] { + return fsPooldetailWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Females: psql.WhereNull[Q, int16](cols.Females), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + PoolID: psql.WhereNull[Q, string](cols.PoolID), + Species: psql.WhereNull[Q, string](cols.Species), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSPooldetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsPooldetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSPooldetails = FSPooldetailSlice{o} + } + return nil + default: + return fmt.Errorf("fsPooldetail has no relationship %q", name) + } +} + +type fsPooldetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSPooldetailPreloader() fsPooldetailPreloader { + return fsPooldetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSPooldetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsPooldetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSPooldetailThenLoader[Q orm.Loadable]() fsPooldetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsPooldetailThenLoader[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 fsPooldetail's Organization into the .R struct +func (o *FSPooldetail) 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.FSPooldetails = FSPooldetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsPooldetail's Organization into the .R struct +func (os FSPooldetailSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSPooldetails = append(rel.R.FSPooldetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsPooldetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsPooldetailJoins[Q]) aliasedAs(alias string) fsPooldetailJoins[Q] { + return buildFSPooldetailJoins[Q](buildFSPooldetailColumns(alias), j.typ) +} + +func buildFSPooldetailJoins[Q dialect.Joinable](cols fsPooldetailColumns, typ string) fsPooldetailJoins[Q] { + return fsPooldetailJoins[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_proposedtreatmentarea.bob.go b/models/fs_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..95450a65 --- /dev/null +++ b/models/fs_proposedtreatmentarea.bob.go @@ -0,0 +1,1483 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSProposedtreatmentarea is an object representing the database table. +type FSProposedtreatmentarea struct { + OrganizationID null.Val[int32] `db:"organization_id" ` + Acres null.Val[float64] `db:"acres" ` + Comments null.Val[string] `db:"comments" ` + Completed null.Val[int16] `db:"completed" ` + Completedby null.Val[string] `db:"completedby" ` + Completeddate null.Val[int64] `db:"completeddate" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Duedate null.Val[int64] `db:"duedate" ` + Exported null.Val[int16] `db:"exported" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Hectares null.Val[float64] `db:"hectares" ` + Issprayroute null.Val[int16] `db:"issprayroute" ` + 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" ` + Method null.Val[string] `db:"method" ` + Name null.Val[string] `db:"name" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Targetapprate null.Val[float64] `db:"targetapprate" ` + Targetproduct null.Val[string] `db:"targetproduct" ` + Targetspecies null.Val[string] `db:"targetspecies" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Updated time.Time `db:"updated" ` + + R fsProposedtreatmentareaR `db:"-" ` +} + +// FSProposedtreatmentareaSlice is an alias for a slice of pointers to FSProposedtreatmentarea. +// This should almost always be used instead of []*FSProposedtreatmentarea. +type FSProposedtreatmentareaSlice []*FSProposedtreatmentarea + +// FSProposedtreatmentareas contains methods to work with the fs_proposedtreatmentarea table +var FSProposedtreatmentareas = psql.NewTablex[*FSProposedtreatmentarea, FSProposedtreatmentareaSlice, *FSProposedtreatmentareaSetter]("", "fs_proposedtreatmentarea", buildFSProposedtreatmentareaColumns("fs_proposedtreatmentarea")) + +// FSProposedtreatmentareasQuery is a query on the fs_proposedtreatmentarea table +type FSProposedtreatmentareasQuery = *psql.ViewQuery[*FSProposedtreatmentarea, FSProposedtreatmentareaSlice] + +// fsProposedtreatmentareaR is where relationships are stored. +type fsProposedtreatmentareaR struct { + Organization *Organization // fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey +} + +func buildFSProposedtreatmentareaColumns(alias string) fsProposedtreatmentareaColumns { + return fsProposedtreatmentareaColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "acres", "comments", "completed", "completedby", "completeddate", "creationdate", "creator", "duedate", "exported", "editdate", "editor", "globalid", "hectares", "issprayroute", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "method", "name", "objectid", "priority", "reviewed", "reviewedby", "revieweddate", "shape__area", "shape__length", "targetapprate", "targetproduct", "targetspecies", "zone", "zone2", "geometry_x", "geometry_y", "updated", + ).WithParent("fs_proposedtreatmentarea"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Acres: psql.Quote(alias, "acres"), + Comments: psql.Quote(alias, "comments"), + Completed: psql.Quote(alias, "completed"), + Completedby: psql.Quote(alias, "completedby"), + Completeddate: psql.Quote(alias, "completeddate"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Duedate: psql.Quote(alias, "duedate"), + Exported: psql.Quote(alias, "exported"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Hectares: psql.Quote(alias, "hectares"), + Issprayroute: psql.Quote(alias, "issprayroute"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Method: psql.Quote(alias, "method"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Targetapprate: psql.Quote(alias, "targetapprate"), + Targetproduct: psql.Quote(alias, "targetproduct"), + Targetspecies: psql.Quote(alias, "targetspecies"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsProposedtreatmentareaColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Acres psql.Expression + Comments psql.Expression + Completed psql.Expression + Completedby psql.Expression + Completeddate psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Duedate psql.Expression + Exported psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Hectares psql.Expression + Issprayroute psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Method psql.Expression + Name psql.Expression + Objectid psql.Expression + Priority psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Targetapprate psql.Expression + Targetproduct psql.Expression + Targetspecies psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Updated psql.Expression +} + +func (c fsProposedtreatmentareaColumns) Alias() string { + return c.tableAlias +} + +func (fsProposedtreatmentareaColumns) AliasedAs(alias string) fsProposedtreatmentareaColumns { + return buildFSProposedtreatmentareaColumns(alias) +} + +// FSProposedtreatmentareaSetter is used for insert/upsert/update operations +// 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" ` + Acres omitnull.Val[float64] `db:"acres" ` + Comments omitnull.Val[string] `db:"comments" ` + Completed omitnull.Val[int16] `db:"completed" ` + Completedby omitnull.Val[string] `db:"completedby" ` + Completeddate omitnull.Val[int64] `db:"completeddate" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Duedate omitnull.Val[int64] `db:"duedate" ` + Exported omitnull.Val[int16] `db:"exported" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Issprayroute omitnull.Val[int16] `db:"issprayroute" ` + 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" ` + Method omitnull.Val[string] `db:"method" ` + Name omitnull.Val[string] `db:"name" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Targetapprate omitnull.Val[float64] `db:"targetapprate" ` + Targetproduct omitnull.Val[string] `db:"targetproduct" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSProposedtreatmentareaSetter) SetColumns() []string { + vals := make([]string, 0, 37) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Completed.IsUnset() { + vals = append(vals, "completed") + } + if !s.Completedby.IsUnset() { + vals = append(vals, "completedby") + } + if !s.Completeddate.IsUnset() { + vals = append(vals, "completeddate") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Duedate.IsUnset() { + vals = append(vals, "duedate") + } + if !s.Exported.IsUnset() { + vals = append(vals, "exported") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Issprayroute.IsUnset() { + vals = append(vals, "issprayroute") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Method.IsUnset() { + vals = append(vals, "method") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Targetapprate.IsUnset() { + vals = append(vals, "targetapprate") + } + if !s.Targetproduct.IsUnset() { + vals = append(vals, "targetproduct") + } + if !s.Targetspecies.IsUnset() { + vals = append(vals, "targetspecies") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSProposedtreatmentareaSetter) Overwrite(t *FSProposedtreatmentarea) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Completed.IsUnset() { + t.Completed = s.Completed.MustGetNull() + } + if !s.Completedby.IsUnset() { + t.Completedby = s.Completedby.MustGetNull() + } + if !s.Completeddate.IsUnset() { + t.Completeddate = s.Completeddate.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Duedate.IsUnset() { + t.Duedate = s.Duedate.MustGetNull() + } + if !s.Exported.IsUnset() { + t.Exported = s.Exported.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Issprayroute.IsUnset() { + t.Issprayroute = s.Issprayroute.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Method.IsUnset() { + t.Method = s.Method.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Targetapprate.IsUnset() { + t.Targetapprate = s.Targetapprate.MustGetNull() + } + if !s.Targetproduct.IsUnset() { + t.Targetproduct = s.Targetproduct.MustGetNull() + } + if !s.Targetspecies.IsUnset() { + t.Targetspecies = s.Targetspecies.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSProposedtreatmentareas.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, 37) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[1] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Completed.IsUnset() { + vals[3] = psql.Arg(s.Completed.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Completedby.IsUnset() { + vals[4] = psql.Arg(s.Completedby.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Completeddate.IsUnset() { + vals[5] = psql.Arg(s.Completeddate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[6] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[7] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Duedate.IsUnset() { + vals[8] = psql.Arg(s.Duedate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Exported.IsUnset() { + vals[9] = psql.Arg(s.Exported.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[10] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[11] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[12] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[13] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Issprayroute.IsUnset() { + vals[14] = psql.Arg(s.Issprayroute.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[15] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[16] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[17] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[18] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[19] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Method.IsUnset() { + vals[20] = psql.Arg(s.Method.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[21] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[22] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[23] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[24] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[25] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[26] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[27] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[28] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Targetapprate.IsUnset() { + vals[29] = psql.Arg(s.Targetapprate.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Targetproduct.IsUnset() { + vals[30] = psql.Arg(s.Targetproduct.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Targetspecies.IsUnset() { + vals[31] = psql.Arg(s.Targetspecies.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[32] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[33] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[34] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[35] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[36] = psql.Arg(s.Updated.MustGet()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 37) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Completed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completed")...), + psql.Arg(s.Completed), + }}) + } + + if !s.Completedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completedby")...), + psql.Arg(s.Completedby), + }}) + } + + if !s.Completeddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completeddate")...), + psql.Arg(s.Completeddate), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Duedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "duedate")...), + psql.Arg(s.Duedate), + }}) + } + + if !s.Exported.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "exported")...), + psql.Arg(s.Exported), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Issprayroute.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "issprayroute")...), + psql.Arg(s.Issprayroute), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Method.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "method")...), + psql.Arg(s.Method), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Targetapprate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetapprate")...), + psql.Arg(s.Targetapprate), + }}) + } + + if !s.Targetproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetproduct")...), + psql.Arg(s.Targetproduct), + }}) + } + + if !s.Targetspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetspecies")...), + psql.Arg(s.Targetspecies), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSProposedtreatmentarea retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSProposedtreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSProposedtreatmentarea, error) { + if len(cols) == 0 { + return FSProposedtreatmentareas.Query( + sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSProposedtreatmentareas.Query( + sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSProposedtreatmentareas.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSProposedtreatmentareaExists checks the presence of a single record by primary key +func FSProposedtreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSProposedtreatmentareas.Query( + sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSProposedtreatmentarea is retrieved from the database +func (o *FSProposedtreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSProposedtreatmentarea +func (o *FSProposedtreatmentarea) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSProposedtreatmentarea) pkEQ() dialect.Expression { + return psql.Quote("fs_proposedtreatmentarea", "objectid").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 FSProposedtreatmentarea +func (o *FSProposedtreatmentarea) Update(ctx context.Context, exec bob.Executor, s *FSProposedtreatmentareaSetter) error { + v, err := FSProposedtreatmentareas.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 FSProposedtreatmentarea record with an executor +func (o *FSProposedtreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSProposedtreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSProposedtreatmentarea using the executor +func (o *FSProposedtreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSProposedtreatmentareas.Query( + sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSProposedtreatmentareaSlice is retrieved from the database +func (o FSProposedtreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSProposedtreatmentareaSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_proposedtreatmentarea", "objectid").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 FSProposedtreatmentareaSlice) copyMatchingRows(from ...*FSProposedtreatmentarea) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSProposedtreatmentareaSlice) 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 FSProposedtreatmentareas.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 *FSProposedtreatmentarea: + o.copyMatchingRows(retrieved) + case []*FSProposedtreatmentarea: + o.copyMatchingRows(retrieved...) + case FSProposedtreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSProposedtreatmentarea or a slice of FSProposedtreatmentarea + // then run the AfterUpdateHooks on the slice + _, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSProposedtreatmentareaSlice) 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 FSProposedtreatmentareas.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 *FSProposedtreatmentarea: + o.copyMatchingRows(retrieved) + case []*FSProposedtreatmentarea: + o.copyMatchingRows(retrieved...) + case FSProposedtreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSProposedtreatmentarea or a slice of FSProposedtreatmentarea + // then run the AfterDeleteHooks on the slice + _, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSProposedtreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSProposedtreatmentareaSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSProposedtreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSProposedtreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSProposedtreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSProposedtreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSProposedtreatmentareas.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 *FSProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentarea0 *FSProposedtreatmentarea, organization1 *Organization) (*FSProposedtreatmentarea, error) { + setter := &FSProposedtreatmentareaSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsProposedtreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSProposedtreatmentareaOrganization0: %w", err) + } + + return fsProposedtreatmentarea0, nil +} + +func (fsProposedtreatmentarea0 *FSProposedtreatmentarea) 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 = attachFSProposedtreatmentareaOrganization0(ctx, exec, 1, fsProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + fsProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.FSProposedtreatmentareas = append(organization1.R.FSProposedtreatmentareas, fsProposedtreatmentarea0) + + return nil +} + +func (fsProposedtreatmentarea0 *FSProposedtreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSProposedtreatmentareaOrganization0(ctx, exec, 1, fsProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + fsProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.FSProposedtreatmentareas = append(organization1.R.FSProposedtreatmentareas, fsProposedtreatmentarea0) + + return nil +} + +type fsProposedtreatmentareaWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Acres psql.WhereNullMod[Q, float64] + Comments psql.WhereNullMod[Q, string] + Completed psql.WhereNullMod[Q, int16] + Completedby psql.WhereNullMod[Q, string] + Completeddate psql.WhereNullMod[Q, int64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Duedate psql.WhereNullMod[Q, int64] + Exported psql.WhereNullMod[Q, int16] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Issprayroute psql.WhereNullMod[Q, int16] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Method psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Targetapprate psql.WhereNullMod[Q, float64] + Targetproduct psql.WhereNullMod[Q, string] + Targetspecies psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsProposedtreatmentareaWhere[Q]) AliasedAs(alias string) fsProposedtreatmentareaWhere[Q] { + return buildFSProposedtreatmentareaWhere[Q](buildFSProposedtreatmentareaColumns(alias)) +} + +func buildFSProposedtreatmentareaWhere[Q psql.Filterable](cols fsProposedtreatmentareaColumns) fsProposedtreatmentareaWhere[Q] { + return fsProposedtreatmentareaWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Completedby: psql.WhereNull[Q, string](cols.Completedby), + Completeddate: psql.WhereNull[Q, int64](cols.Completeddate), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Duedate: psql.WhereNull[Q, int64](cols.Duedate), + Exported: psql.WhereNull[Q, int16](cols.Exported), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Issprayroute: psql.WhereNull[Q, int16](cols.Issprayroute), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Method: psql.WhereNull[Q, string](cols.Method), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Targetapprate: psql.WhereNull[Q, float64](cols.Targetapprate), + Targetproduct: psql.WhereNull[Q, string](cols.Targetproduct), + Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSProposedtreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsProposedtreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSProposedtreatmentareas = FSProposedtreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("fsProposedtreatmentarea has no relationship %q", name) + } +} + +type fsProposedtreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSProposedtreatmentareaPreloader() fsProposedtreatmentareaPreloader { + return fsProposedtreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSProposedtreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsProposedtreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSProposedtreatmentareaThenLoader[Q orm.Loadable]() fsProposedtreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsProposedtreatmentareaThenLoader[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 fsProposedtreatmentarea's Organization into the .R struct +func (o *FSProposedtreatmentarea) 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.FSProposedtreatmentareas = FSProposedtreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsProposedtreatmentarea's Organization into the .R struct +func (os FSProposedtreatmentareaSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSProposedtreatmentareas = append(rel.R.FSProposedtreatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsProposedtreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsProposedtreatmentareaJoins[Q]) aliasedAs(alias string) fsProposedtreatmentareaJoins[Q] { + return buildFSProposedtreatmentareaJoins[Q](buildFSProposedtreatmentareaColumns(alias), j.typ) +} + +func buildFSProposedtreatmentareaJoins[Q dialect.Joinable](cols fsProposedtreatmentareaColumns, typ string) fsProposedtreatmentareaJoins[Q] { + return fsProposedtreatmentareaJoins[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_qamosquitoinspection.bob.go b/models/fs_qamosquitoinspection.bob.go new file mode 100644 index 00000000..1cf036e5 --- /dev/null +++ b/models/fs_qamosquitoinspection.bob.go @@ -0,0 +1,2208 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSQamosquitoinspection is an object representing the database table. +type FSQamosquitoinspection 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" ` + Updated time.Time `db:"updated" ` + + R fsQamosquitoinspectionR `db:"-" ` +} + +// FSQamosquitoinspectionSlice is an alias for a slice of pointers to FSQamosquitoinspection. +// This should almost always be used instead of []*FSQamosquitoinspection. +type FSQamosquitoinspectionSlice []*FSQamosquitoinspection + +// FSQamosquitoinspections contains methods to work with the fs_qamosquitoinspection table +var FSQamosquitoinspections = psql.NewTablex[*FSQamosquitoinspection, FSQamosquitoinspectionSlice, *FSQamosquitoinspectionSetter]("", "fs_qamosquitoinspection", buildFSQamosquitoinspectionColumns("fs_qamosquitoinspection")) + +// FSQamosquitoinspectionsQuery is a query on the fs_qamosquitoinspection table +type FSQamosquitoinspectionsQuery = *psql.ViewQuery[*FSQamosquitoinspection, FSQamosquitoinspectionSlice] + +// fsQamosquitoinspectionR is where relationships are stored. +type fsQamosquitoinspectionR struct { + Organization *Organization // fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey +} + +func buildFSQamosquitoinspectionColumns(alias string) fsQamosquitoinspectionColumns { + return fsQamosquitoinspectionColumns{ + 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", "updated", + ).WithParent("fs_qamosquitoinspection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Acresbreeding: psql.Quote(alias, "acresbreeding"), + Actiontaken: psql.Quote(alias, "actiontaken"), + Adultactivity: psql.Quote(alias, "adultactivity"), + Aquaticorganisms: psql.Quote(alias, "aquaticorganisms"), + Avetemp: psql.Quote(alias, "avetemp"), + Breedingpotential: psql.Quote(alias, "breedingpotential"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Fish: psql.Quote(alias, "fish"), + Globalid: psql.Quote(alias, "globalid"), + Habvalue1: psql.Quote(alias, "habvalue1"), + Habvalue1percent: psql.Quote(alias, "habvalue1percent"), + Habvalue2: psql.Quote(alias, "habvalue2"), + Habvalue2percent: psql.Quote(alias, "habvalue2percent"), + Larvaeinsidetreatedarea: psql.Quote(alias, "larvaeinsidetreatedarea"), + Larvaeoutsidetreatedarea: psql.Quote(alias, "larvaeoutsidetreatedarea"), + Larvaepresent: psql.Quote(alias, "larvaepresent"), + Larvaereason: psql.Quote(alias, "larvaereason"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + LR: psql.Quote(alias, "lr"), + Mosquitohabitat: psql.Quote(alias, "mosquitohabitat"), + Movingwater: psql.Quote(alias, "movingwater"), + Negdips: psql.Quote(alias, "negdips"), + Nowaterever: psql.Quote(alias, "nowaterever"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Posdips: psql.Quote(alias, "posdips"), + Potential: psql.Quote(alias, "potential"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sitetype: psql.Quote(alias, "sitetype"), + Soilconditions: psql.Quote(alias, "soilconditions"), + Sourcereduction: psql.Quote(alias, "sourcereduction"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Totalacres: psql.Quote(alias, "totalacres"), + Vegetation: psql.Quote(alias, "vegetation"), + Waterconditions: psql.Quote(alias, "waterconditions"), + Waterduration: psql.Quote(alias, "waterduration"), + Watermovement1: psql.Quote(alias, "watermovement1"), + Watermovement1percent: psql.Quote(alias, "watermovement1percent"), + Watermovement2: psql.Quote(alias, "watermovement2"), + Watermovement2percent: psql.Quote(alias, "watermovement2percent"), + Waterpresent: psql.Quote(alias, "waterpresent"), + Watersource: psql.Quote(alias, "watersource"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsQamosquitoinspectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Acresbreeding psql.Expression + Actiontaken psql.Expression + Adultactivity psql.Expression + Aquaticorganisms psql.Expression + Avetemp psql.Expression + Breedingpotential psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Fish psql.Expression + Globalid psql.Expression + Habvalue1 psql.Expression + Habvalue1percent psql.Expression + Habvalue2 psql.Expression + Habvalue2percent psql.Expression + Larvaeinsidetreatedarea psql.Expression + Larvaeoutsidetreatedarea psql.Expression + Larvaepresent psql.Expression + Larvaereason psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + LR psql.Expression + Mosquitohabitat psql.Expression + Movingwater psql.Expression + Negdips psql.Expression + Nowaterever psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Posdips psql.Expression + Potential psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sitetype psql.Expression + Soilconditions psql.Expression + Sourcereduction psql.Expression + Startdatetime psql.Expression + Totalacres psql.Expression + Vegetation psql.Expression + Waterconditions psql.Expression + Waterduration psql.Expression + Watermovement1 psql.Expression + Watermovement1percent psql.Expression + Watermovement2 psql.Expression + Watermovement2percent psql.Expression + Waterpresent psql.Expression + Watersource psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsQamosquitoinspectionColumns) Alias() string { + return c.tableAlias +} + +func (fsQamosquitoinspectionColumns) AliasedAs(alias string) fsQamosquitoinspectionColumns { + return buildFSQamosquitoinspectionColumns(alias) +} + +// FSQamosquitoinspectionSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSQamosquitoinspectionSetter) SetColumns() []string { + vals := make([]string, 0, 66) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Acresbreeding.IsUnset() { + vals = append(vals, "acresbreeding") + } + if !s.Actiontaken.IsUnset() { + vals = append(vals, "actiontaken") + } + if !s.Adultactivity.IsUnset() { + vals = append(vals, "adultactivity") + } + if !s.Aquaticorganisms.IsUnset() { + vals = append(vals, "aquaticorganisms") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Breedingpotential.IsUnset() { + vals = append(vals, "breedingpotential") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Fish.IsUnset() { + vals = append(vals, "fish") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habvalue1.IsUnset() { + vals = append(vals, "habvalue1") + } + if !s.Habvalue1percent.IsUnset() { + vals = append(vals, "habvalue1percent") + } + if !s.Habvalue2.IsUnset() { + vals = append(vals, "habvalue2") + } + if !s.Habvalue2percent.IsUnset() { + vals = append(vals, "habvalue2percent") + } + if !s.Larvaeinsidetreatedarea.IsUnset() { + vals = append(vals, "larvaeinsidetreatedarea") + } + if !s.Larvaeoutsidetreatedarea.IsUnset() { + vals = append(vals, "larvaeoutsidetreatedarea") + } + if !s.Larvaepresent.IsUnset() { + vals = append(vals, "larvaepresent") + } + if !s.Larvaereason.IsUnset() { + vals = append(vals, "larvaereason") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LR.IsUnset() { + vals = append(vals, "lr") + } + if !s.Mosquitohabitat.IsUnset() { + vals = append(vals, "mosquitohabitat") + } + if !s.Movingwater.IsUnset() { + vals = append(vals, "movingwater") + } + if !s.Negdips.IsUnset() { + vals = append(vals, "negdips") + } + if !s.Nowaterever.IsUnset() { + vals = append(vals, "nowaterever") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Posdips.IsUnset() { + vals = append(vals, "posdips") + } + if !s.Potential.IsUnset() { + vals = append(vals, "potential") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sitetype.IsUnset() { + vals = append(vals, "sitetype") + } + if !s.Soilconditions.IsUnset() { + vals = append(vals, "soilconditions") + } + if !s.Sourcereduction.IsUnset() { + vals = append(vals, "sourcereduction") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Totalacres.IsUnset() { + vals = append(vals, "totalacres") + } + if !s.Vegetation.IsUnset() { + vals = append(vals, "vegetation") + } + if !s.Waterconditions.IsUnset() { + vals = append(vals, "waterconditions") + } + if !s.Waterduration.IsUnset() { + vals = append(vals, "waterduration") + } + if !s.Watermovement1.IsUnset() { + vals = append(vals, "watermovement1") + } + if !s.Watermovement1percent.IsUnset() { + vals = append(vals, "watermovement1percent") + } + if !s.Watermovement2.IsUnset() { + vals = append(vals, "watermovement2") + } + if !s.Watermovement2percent.IsUnset() { + vals = append(vals, "watermovement2percent") + } + if !s.Waterpresent.IsUnset() { + vals = append(vals, "waterpresent") + } + if !s.Watersource.IsUnset() { + vals = append(vals, "watersource") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSQamosquitoinspectionSetter) Overwrite(t *FSQamosquitoinspection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Acresbreeding.IsUnset() { + t.Acresbreeding = s.Acresbreeding.MustGetNull() + } + if !s.Actiontaken.IsUnset() { + t.Actiontaken = s.Actiontaken.MustGetNull() + } + if !s.Adultactivity.IsUnset() { + t.Adultactivity = s.Adultactivity.MustGetNull() + } + if !s.Aquaticorganisms.IsUnset() { + t.Aquaticorganisms = s.Aquaticorganisms.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Breedingpotential.IsUnset() { + t.Breedingpotential = s.Breedingpotential.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Fish.IsUnset() { + t.Fish = s.Fish.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habvalue1.IsUnset() { + t.Habvalue1 = s.Habvalue1.MustGetNull() + } + if !s.Habvalue1percent.IsUnset() { + t.Habvalue1percent = s.Habvalue1percent.MustGetNull() + } + if !s.Habvalue2.IsUnset() { + t.Habvalue2 = s.Habvalue2.MustGetNull() + } + if !s.Habvalue2percent.IsUnset() { + t.Habvalue2percent = s.Habvalue2percent.MustGetNull() + } + if !s.Larvaeinsidetreatedarea.IsUnset() { + t.Larvaeinsidetreatedarea = s.Larvaeinsidetreatedarea.MustGetNull() + } + if !s.Larvaeoutsidetreatedarea.IsUnset() { + t.Larvaeoutsidetreatedarea = s.Larvaeoutsidetreatedarea.MustGetNull() + } + if !s.Larvaepresent.IsUnset() { + t.Larvaepresent = s.Larvaepresent.MustGetNull() + } + if !s.Larvaereason.IsUnset() { + t.Larvaereason = s.Larvaereason.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LR.IsUnset() { + t.LR = s.LR.MustGetNull() + } + if !s.Mosquitohabitat.IsUnset() { + t.Mosquitohabitat = s.Mosquitohabitat.MustGetNull() + } + if !s.Movingwater.IsUnset() { + t.Movingwater = s.Movingwater.MustGetNull() + } + if !s.Negdips.IsUnset() { + t.Negdips = s.Negdips.MustGetNull() + } + if !s.Nowaterever.IsUnset() { + t.Nowaterever = s.Nowaterever.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Posdips.IsUnset() { + t.Posdips = s.Posdips.MustGetNull() + } + if !s.Potential.IsUnset() { + t.Potential = s.Potential.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sitetype.IsUnset() { + t.Sitetype = s.Sitetype.MustGetNull() + } + if !s.Soilconditions.IsUnset() { + t.Soilconditions = s.Soilconditions.MustGetNull() + } + if !s.Sourcereduction.IsUnset() { + t.Sourcereduction = s.Sourcereduction.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Totalacres.IsUnset() { + t.Totalacres = s.Totalacres.MustGetNull() + } + if !s.Vegetation.IsUnset() { + t.Vegetation = s.Vegetation.MustGetNull() + } + if !s.Waterconditions.IsUnset() { + t.Waterconditions = s.Waterconditions.MustGetNull() + } + if !s.Waterduration.IsUnset() { + t.Waterduration = s.Waterduration.MustGetNull() + } + if !s.Watermovement1.IsUnset() { + t.Watermovement1 = s.Watermovement1.MustGetNull() + } + if !s.Watermovement1percent.IsUnset() { + t.Watermovement1percent = s.Watermovement1percent.MustGetNull() + } + if !s.Watermovement2.IsUnset() { + t.Watermovement2 = s.Watermovement2.MustGetNull() + } + if !s.Watermovement2percent.IsUnset() { + t.Watermovement2percent = s.Watermovement2percent.MustGetNull() + } + if !s.Waterpresent.IsUnset() { + t.Waterpresent = s.Waterpresent.MustGetNull() + } + if !s.Watersource.IsUnset() { + t.Watersource = s.Watersource.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSQamosquitoinspections.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, 66) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Acresbreeding.IsUnset() { + vals[1] = psql.Arg(s.Acresbreeding.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Actiontaken.IsUnset() { + vals[2] = psql.Arg(s.Actiontaken.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Adultactivity.IsUnset() { + vals[3] = psql.Arg(s.Adultactivity.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Aquaticorganisms.IsUnset() { + vals[4] = psql.Arg(s.Aquaticorganisms.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[5] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Breedingpotential.IsUnset() { + vals[6] = psql.Arg(s.Breedingpotential.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[7] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[8] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[9] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[11] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[12] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[13] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fish.IsUnset() { + vals[14] = psql.Arg(s.Fish.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[15] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Habvalue1.IsUnset() { + vals[16] = psql.Arg(s.Habvalue1.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Habvalue1percent.IsUnset() { + vals[17] = psql.Arg(s.Habvalue1percent.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Habvalue2.IsUnset() { + vals[18] = psql.Arg(s.Habvalue2.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Habvalue2percent.IsUnset() { + vals[19] = psql.Arg(s.Habvalue2percent.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Larvaeinsidetreatedarea.IsUnset() { + vals[20] = psql.Arg(s.Larvaeinsidetreatedarea.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Larvaeoutsidetreatedarea.IsUnset() { + vals[21] = psql.Arg(s.Larvaeoutsidetreatedarea.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Larvaepresent.IsUnset() { + vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Larvaereason.IsUnset() { + vals[23] = psql.Arg(s.Larvaereason.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[24] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[25] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LR.IsUnset() { + vals[26] = psql.Arg(s.LR.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Mosquitohabitat.IsUnset() { + vals[27] = psql.Arg(s.Mosquitohabitat.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Movingwater.IsUnset() { + vals[28] = psql.Arg(s.Movingwater.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Negdips.IsUnset() { + vals[29] = psql.Arg(s.Negdips.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Nowaterever.IsUnset() { + vals[30] = psql.Arg(s.Nowaterever.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[31] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[32] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[33] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Posdips.IsUnset() { + vals[34] = psql.Arg(s.Posdips.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Potential.IsUnset() { + vals[35] = psql.Arg(s.Potential.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[36] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[37] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[38] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[39] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[40] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Sitetype.IsUnset() { + vals[41] = psql.Arg(s.Sitetype.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Soilconditions.IsUnset() { + vals[42] = psql.Arg(s.Soilconditions.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Sourcereduction.IsUnset() { + vals[43] = psql.Arg(s.Sourcereduction.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[44] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Totalacres.IsUnset() { + vals[45] = psql.Arg(s.Totalacres.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Vegetation.IsUnset() { + vals[46] = psql.Arg(s.Vegetation.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Waterconditions.IsUnset() { + vals[47] = psql.Arg(s.Waterconditions.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Waterduration.IsUnset() { + vals[48] = psql.Arg(s.Waterduration.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Watermovement1.IsUnset() { + vals[49] = psql.Arg(s.Watermovement1.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Watermovement1percent.IsUnset() { + vals[50] = psql.Arg(s.Watermovement1percent.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Watermovement2.IsUnset() { + vals[51] = psql.Arg(s.Watermovement2.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Watermovement2percent.IsUnset() { + vals[52] = psql.Arg(s.Watermovement2percent.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Waterpresent.IsUnset() { + vals[53] = psql.Arg(s.Waterpresent.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.Watersource.IsUnset() { + vals[54] = psql.Arg(s.Watersource.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[55] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[56] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[57] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[58] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[59] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[60] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[61] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[61] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[62] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[62] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[63] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[63] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[64] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[64] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[65] = psql.Arg(s.Updated.MustGet()) + } else { + vals[65] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 66) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Acresbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acresbreeding")...), + psql.Arg(s.Acresbreeding), + }}) + } + + if !s.Actiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "actiontaken")...), + psql.Arg(s.Actiontaken), + }}) + } + + if !s.Adultactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adultactivity")...), + psql.Arg(s.Adultactivity), + }}) + } + + if !s.Aquaticorganisms.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "aquaticorganisms")...), + psql.Arg(s.Aquaticorganisms), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Breedingpotential.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "breedingpotential")...), + psql.Arg(s.Breedingpotential), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Fish.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fish")...), + psql.Arg(s.Fish), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habvalue1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue1")...), + psql.Arg(s.Habvalue1), + }}) + } + + if !s.Habvalue1percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue1percent")...), + psql.Arg(s.Habvalue1percent), + }}) + } + + if !s.Habvalue2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue2")...), + psql.Arg(s.Habvalue2), + }}) + } + + if !s.Habvalue2percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue2percent")...), + psql.Arg(s.Habvalue2percent), + }}) + } + + if !s.Larvaeinsidetreatedarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaeinsidetreatedarea")...), + psql.Arg(s.Larvaeinsidetreatedarea), + }}) + } + + if !s.Larvaeoutsidetreatedarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaeoutsidetreatedarea")...), + psql.Arg(s.Larvaeoutsidetreatedarea), + }}) + } + + if !s.Larvaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaepresent")...), + psql.Arg(s.Larvaepresent), + }}) + } + + if !s.Larvaereason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaereason")...), + psql.Arg(s.Larvaereason), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LR.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lr")...), + psql.Arg(s.LR), + }}) + } + + if !s.Mosquitohabitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "mosquitohabitat")...), + psql.Arg(s.Mosquitohabitat), + }}) + } + + if !s.Movingwater.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "movingwater")...), + psql.Arg(s.Movingwater), + }}) + } + + if !s.Negdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "negdips")...), + psql.Arg(s.Negdips), + }}) + } + + if !s.Nowaterever.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nowaterever")...), + psql.Arg(s.Nowaterever), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Posdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "posdips")...), + psql.Arg(s.Posdips), + }}) + } + + if !s.Potential.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "potential")...), + psql.Arg(s.Potential), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sitetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitetype")...), + psql.Arg(s.Sitetype), + }}) + } + + if !s.Soilconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "soilconditions")...), + psql.Arg(s.Soilconditions), + }}) + } + + if !s.Sourcereduction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sourcereduction")...), + psql.Arg(s.Sourcereduction), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Totalacres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totalacres")...), + psql.Arg(s.Totalacres), + }}) + } + + if !s.Vegetation.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vegetation")...), + psql.Arg(s.Vegetation), + }}) + } + + if !s.Waterconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterconditions")...), + psql.Arg(s.Waterconditions), + }}) + } + + if !s.Waterduration.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterduration")...), + psql.Arg(s.Waterduration), + }}) + } + + if !s.Watermovement1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement1")...), + psql.Arg(s.Watermovement1), + }}) + } + + if !s.Watermovement1percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement1percent")...), + psql.Arg(s.Watermovement1percent), + }}) + } + + if !s.Watermovement2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement2")...), + psql.Arg(s.Watermovement2), + }}) + } + + if !s.Watermovement2percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement2percent")...), + psql.Arg(s.Watermovement2percent), + }}) + } + + if !s.Waterpresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterpresent")...), + psql.Arg(s.Waterpresent), + }}) + } + + if !s.Watersource.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watersource")...), + psql.Arg(s.Watersource), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSQamosquitoinspection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSQamosquitoinspection, error) { + if len(cols) == 0 { + return FSQamosquitoinspections.Query( + sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSQamosquitoinspections.Query( + sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSQamosquitoinspections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSQamosquitoinspectionExists checks the presence of a single record by primary key +func FSQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSQamosquitoinspections.Query( + sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSQamosquitoinspection is retrieved from the database +func (o *FSQamosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSQamosquitoinspection +func (o *FSQamosquitoinspection) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSQamosquitoinspection) pkEQ() dialect.Expression { + return psql.Quote("fs_qamosquitoinspection", "objectid").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 FSQamosquitoinspection +func (o *FSQamosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *FSQamosquitoinspectionSetter) error { + v, err := FSQamosquitoinspections.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 FSQamosquitoinspection record with an executor +func (o *FSQamosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSQamosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSQamosquitoinspection using the executor +func (o *FSQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSQamosquitoinspections.Query( + sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSQamosquitoinspectionSlice is retrieved from the database +func (o FSQamosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSQamosquitoinspectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_qamosquitoinspection", "objectid").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 FSQamosquitoinspectionSlice) copyMatchingRows(from ...*FSQamosquitoinspection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSQamosquitoinspectionSlice) 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 FSQamosquitoinspections.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 *FSQamosquitoinspection: + o.copyMatchingRows(retrieved) + case []*FSQamosquitoinspection: + o.copyMatchingRows(retrieved...) + case FSQamosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSQamosquitoinspection or a slice of FSQamosquitoinspection + // then run the AfterUpdateHooks on the slice + _, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSQamosquitoinspectionSlice) 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 FSQamosquitoinspections.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 *FSQamosquitoinspection: + o.copyMatchingRows(retrieved) + case []*FSQamosquitoinspection: + o.copyMatchingRows(retrieved...) + case FSQamosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSQamosquitoinspection or a slice of FSQamosquitoinspection + // then run the AfterDeleteHooks on the slice + _, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSQamosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSQamosquitoinspectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSQamosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSQamosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSQamosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSQamosquitoinspections.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 *FSQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspection0 *FSQamosquitoinspection, organization1 *Organization) (*FSQamosquitoinspection, error) { + setter := &FSQamosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsQamosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSQamosquitoinspectionOrganization0: %w", err) + } + + return fsQamosquitoinspection0, nil +} + +func (fsQamosquitoinspection0 *FSQamosquitoinspection) 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 = attachFSQamosquitoinspectionOrganization0(ctx, exec, 1, fsQamosquitoinspection0, organization1) + if err != nil { + return err + } + + fsQamosquitoinspection0.R.Organization = organization1 + + organization1.R.FSQamosquitoinspections = append(organization1.R.FSQamosquitoinspections, fsQamosquitoinspection0) + + return nil +} + +func (fsQamosquitoinspection0 *FSQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSQamosquitoinspectionOrganization0(ctx, exec, 1, fsQamosquitoinspection0, organization1) + if err != nil { + return err + } + + fsQamosquitoinspection0.R.Organization = organization1 + + organization1.R.FSQamosquitoinspections = append(organization1.R.FSQamosquitoinspections, fsQamosquitoinspection0) + + return nil +} + +type fsQamosquitoinspectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Acresbreeding psql.WhereNullMod[Q, float64] + Actiontaken psql.WhereNullMod[Q, string] + Adultactivity psql.WhereNullMod[Q, int16] + Aquaticorganisms psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Breedingpotential psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Fish psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habvalue1 psql.WhereNullMod[Q, int16] + Habvalue1percent psql.WhereNullMod[Q, int16] + Habvalue2 psql.WhereNullMod[Q, int16] + Habvalue2percent psql.WhereNullMod[Q, int16] + Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaepresent psql.WhereNullMod[Q, int16] + Larvaereason psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LR psql.WhereNullMod[Q, int16] + Mosquitohabitat psql.WhereNullMod[Q, string] + Movingwater psql.WhereNullMod[Q, int16] + Negdips psql.WhereNullMod[Q, int16] + Nowaterever psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Posdips psql.WhereNullMod[Q, int16] + Potential psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sitetype psql.WhereNullMod[Q, string] + Soilconditions psql.WhereNullMod[Q, string] + Sourcereduction psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Totalacres psql.WhereNullMod[Q, float64] + Vegetation psql.WhereNullMod[Q, string] + Waterconditions psql.WhereNullMod[Q, string] + Waterduration psql.WhereNullMod[Q, string] + Watermovement1 psql.WhereNullMod[Q, string] + Watermovement1percent psql.WhereNullMod[Q, int16] + Watermovement2 psql.WhereNullMod[Q, string] + Watermovement2percent psql.WhereNullMod[Q, int16] + Waterpresent psql.WhereNullMod[Q, int16] + Watersource psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fsQamosquitoinspectionWhere[Q] { + return buildFSQamosquitoinspectionWhere[Q](buildFSQamosquitoinspectionColumns(alias)) +} + +func buildFSQamosquitoinspectionWhere[Q psql.Filterable](cols fsQamosquitoinspectionColumns) fsQamosquitoinspectionWhere[Q] { + return fsQamosquitoinspectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms), + Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), + Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Fish: psql.WhereNull[Q, int16](cols.Fish), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1), + Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent), + Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2), + Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent), + Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea), + Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LR: psql.WhereNull[Q, int16](cols.LR), + Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat), + Movingwater: psql.WhereNull[Q, int16](cols.Movingwater), + Negdips: psql.WhereNull[Q, int16](cols.Negdips), + Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Posdips: psql.WhereNull[Q, int16](cols.Posdips), + Potential: psql.WhereNull[Q, int16](cols.Potential), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sitetype: psql.WhereNull[Q, string](cols.Sitetype), + Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions), + Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Totalacres: psql.WhereNull[Q, float64](cols.Totalacres), + Vegetation: psql.WhereNull[Q, string](cols.Vegetation), + Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions), + Waterduration: psql.WhereNull[Q, string](cols.Waterduration), + Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1), + Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent), + Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2), + Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent), + Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent), + Watersource: psql.WhereNull[Q, string](cols.Watersource), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSQamosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsQamosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSQamosquitoinspections = FSQamosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("fsQamosquitoinspection has no relationship %q", name) + } +} + +type fsQamosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSQamosquitoinspectionPreloader() fsQamosquitoinspectionPreloader { + return fsQamosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSQamosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsQamosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSQamosquitoinspectionThenLoader[Q orm.Loadable]() fsQamosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsQamosquitoinspectionThenLoader[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 fsQamosquitoinspection's Organization into the .R struct +func (o *FSQamosquitoinspection) 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.FSQamosquitoinspections = FSQamosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsQamosquitoinspection's Organization into the .R struct +func (os FSQamosquitoinspectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSQamosquitoinspections = append(rel.R.FSQamosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsQamosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsQamosquitoinspectionJoins[Q]) aliasedAs(alias string) fsQamosquitoinspectionJoins[Q] { + return buildFSQamosquitoinspectionJoins[Q](buildFSQamosquitoinspectionColumns(alias), j.typ) +} + +func buildFSQamosquitoinspectionJoins[Q dialect.Joinable](cols fsQamosquitoinspectionColumns, typ string) fsQamosquitoinspectionJoins[Q] { + return fsQamosquitoinspectionJoins[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_rodentlocation.bob.go b/models/fs_rodentlocation.bob.go new file mode 100644 index 00000000..3fb455b9 --- /dev/null +++ b/models/fs_rodentlocation.bob.go @@ -0,0 +1,1408 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSRodentlocation is an object representing the database table. +type FSRodentlocation 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" ` + Updated time.Time `db:"updated" ` + + R fsRodentlocationR `db:"-" ` +} + +// FSRodentlocationSlice is an alias for a slice of pointers to FSRodentlocation. +// This should almost always be used instead of []*FSRodentlocation. +type FSRodentlocationSlice []*FSRodentlocation + +// FSRodentlocations contains methods to work with the fs_rodentlocation table +var FSRodentlocations = psql.NewTablex[*FSRodentlocation, FSRodentlocationSlice, *FSRodentlocationSetter]("", "fs_rodentlocation", buildFSRodentlocationColumns("fs_rodentlocation")) + +// FSRodentlocationsQuery is a query on the fs_rodentlocation table +type FSRodentlocationsQuery = *psql.ViewQuery[*FSRodentlocation, FSRodentlocationSlice] + +// fsRodentlocationR is where relationships are stored. +type fsRodentlocationR struct { + Organization *Organization // fs_rodentlocation.fs_rodentlocation_organization_id_fkey +} + +func buildFSRodentlocationColumns(alias string) fsRodentlocationColumns { + return fsRodentlocationColumns{ + 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", "updated", + ).WithParent("fs_rodentlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Lastinspectaction: psql.Quote(alias, "lastinspectaction"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectrodentevidence: psql.Quote(alias, "lastinspectrodentevidence"), + Lastinspectspecies: psql.Quote(alias, "lastinspectspecies"), + Locationname: psql.Quote(alias, "locationname"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsRodentlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Lastinspectaction psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectrodentevidence psql.Expression + Lastinspectspecies psql.Expression + Locationname psql.Expression + Locationnumber psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Jurisdiction psql.Expression + Updated psql.Expression +} + +func (c fsRodentlocationColumns) Alias() string { + return c.tableAlias +} + +func (fsRodentlocationColumns) AliasedAs(alias string) fsRodentlocationColumns { + return buildFSRodentlocationColumns(alias) +} + +// FSRodentlocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSRodentlocationSetter) SetColumns() []string { + vals := make([]string, 0, 34) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Lastinspectaction.IsUnset() { + vals = append(vals, "lastinspectaction") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectrodentevidence.IsUnset() { + vals = append(vals, "lastinspectrodentevidence") + } + if !s.Lastinspectspecies.IsUnset() { + vals = append(vals, "lastinspectspecies") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSRodentlocationSetter) Overwrite(t *FSRodentlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Lastinspectaction.IsUnset() { + t.Lastinspectaction = s.Lastinspectaction.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectrodentevidence.IsUnset() { + t.Lastinspectrodentevidence = s.Lastinspectrodentevidence.MustGetNull() + } + if !s.Lastinspectspecies.IsUnset() { + t.Lastinspectspecies = s.Lastinspectspecies.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSRodentlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSRodentlocations.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, 34) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[10] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[11] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectaction.IsUnset() { + vals[12] = psql.Arg(s.Lastinspectaction.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[13] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[14] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectrodentevidence.IsUnset() { + vals[15] = psql.Arg(s.Lastinspectrodentevidence.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectspecies.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectspecies.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[17] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[18] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[19] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[20] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[21] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[22] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[23] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[24] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[25] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[26] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[27] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[28] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[29] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[30] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[31] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[32] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[33] = psql.Arg(s.Updated.MustGet()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 34) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Lastinspectaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectaction")...), + psql.Arg(s.Lastinspectaction), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectrodentevidence.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectrodentevidence")...), + psql.Arg(s.Lastinspectrodentevidence), + }}) + } + + if !s.Lastinspectspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectspecies")...), + psql.Arg(s.Lastinspectspecies), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSRodentlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSRodentlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSRodentlocation, error) { + if len(cols) == 0 { + return FSRodentlocations.Query( + sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSRodentlocations.Query( + sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSRodentlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSRodentlocationExists checks the presence of a single record by primary key +func FSRodentlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSRodentlocations.Query( + sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSRodentlocation is retrieved from the database +func (o *FSRodentlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSRodentlocation +func (o *FSRodentlocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSRodentlocation) pkEQ() dialect.Expression { + return psql.Quote("fs_rodentlocation", "objectid").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 FSRodentlocation +func (o *FSRodentlocation) Update(ctx context.Context, exec bob.Executor, s *FSRodentlocationSetter) error { + v, err := FSRodentlocations.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 FSRodentlocation record with an executor +func (o *FSRodentlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSRodentlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSRodentlocation using the executor +func (o *FSRodentlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSRodentlocations.Query( + sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSRodentlocationSlice is retrieved from the database +func (o FSRodentlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSRodentlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_rodentlocation", "objectid").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 FSRodentlocationSlice) copyMatchingRows(from ...*FSRodentlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSRodentlocationSlice) 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 FSRodentlocations.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 *FSRodentlocation: + o.copyMatchingRows(retrieved) + case []*FSRodentlocation: + o.copyMatchingRows(retrieved...) + case FSRodentlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSRodentlocation or a slice of FSRodentlocation + // then run the AfterUpdateHooks on the slice + _, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSRodentlocationSlice) 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 FSRodentlocations.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 *FSRodentlocation: + o.copyMatchingRows(retrieved) + case []*FSRodentlocation: + o.copyMatchingRows(retrieved...) + case FSRodentlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSRodentlocation or a slice of FSRodentlocation + // then run the AfterDeleteHooks on the slice + _, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSRodentlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSRodentlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSRodentlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSRodentlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSRodentlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSRodentlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSRodentlocations.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 *FSRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsRodentlocation0 *FSRodentlocation, organization1 *Organization) (*FSRodentlocation, error) { + setter := &FSRodentlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsRodentlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSRodentlocationOrganization0: %w", err) + } + + return fsRodentlocation0, nil +} + +func (fsRodentlocation0 *FSRodentlocation) 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 = attachFSRodentlocationOrganization0(ctx, exec, 1, fsRodentlocation0, organization1) + if err != nil { + return err + } + + fsRodentlocation0.R.Organization = organization1 + + organization1.R.FSRodentlocations = append(organization1.R.FSRodentlocations, fsRodentlocation0) + + return nil +} + +func (fsRodentlocation0 *FSRodentlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSRodentlocationOrganization0(ctx, exec, 1, fsRodentlocation0, organization1) + if err != nil { + return err + } + + fsRodentlocation0.R.Organization = organization1 + + organization1.R.FSRodentlocations = append(organization1.R.FSRodentlocations, fsRodentlocation0) + + return nil +} + +type fsRodentlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Lastinspectaction psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectrodentevidence psql.WhereNullMod[Q, string] + Lastinspectspecies psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsRodentlocationWhere[Q]) AliasedAs(alias string) fsRodentlocationWhere[Q] { + return buildFSRodentlocationWhere[Q](buildFSRodentlocationColumns(alias)) +} + +func buildFSRodentlocationWhere[Q psql.Filterable](cols fsRodentlocationColumns) fsRodentlocationWhere[Q] { + return fsRodentlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Lastinspectaction: psql.WhereNull[Q, string](cols.Lastinspectaction), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectrodentevidence: psql.WhereNull[Q, string](cols.Lastinspectrodentevidence), + Lastinspectspecies: psql.WhereNull[Q, string](cols.Lastinspectspecies), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSRodentlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsRodentlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSRodentlocations = FSRodentlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsRodentlocation has no relationship %q", name) + } +} + +type fsRodentlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSRodentlocationPreloader() fsRodentlocationPreloader { + return fsRodentlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSRodentlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsRodentlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSRodentlocationThenLoader[Q orm.Loadable]() fsRodentlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsRodentlocationThenLoader[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 fsRodentlocation's Organization into the .R struct +func (o *FSRodentlocation) 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.FSRodentlocations = FSRodentlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsRodentlocation's Organization into the .R struct +func (os FSRodentlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSRodentlocations = append(rel.R.FSRodentlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsRodentlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsRodentlocationJoins[Q]) aliasedAs(alias string) fsRodentlocationJoins[Q] { + return buildFSRodentlocationJoins[Q](buildFSRodentlocationColumns(alias), j.typ) +} + +func buildFSRodentlocationJoins[Q dialect.Joinable](cols fsRodentlocationColumns, typ string) fsRodentlocationJoins[Q] { + return fsRodentlocationJoins[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_samplecollection.bob.go b/models/fs_samplecollection.bob.go new file mode 100644 index 00000000..495a1784 --- /dev/null +++ b/models/fs_samplecollection.bob.go @@ -0,0 +1,1808 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSSamplecollection is an object representing the database table. +type FSSamplecollection 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" ` + Updated time.Time `db:"updated" ` + + R fsSamplecollectionR `db:"-" ` +} + +// FSSamplecollectionSlice is an alias for a slice of pointers to FSSamplecollection. +// This should almost always be used instead of []*FSSamplecollection. +type FSSamplecollectionSlice []*FSSamplecollection + +// FSSamplecollections contains methods to work with the fs_samplecollection table +var FSSamplecollections = psql.NewTablex[*FSSamplecollection, FSSamplecollectionSlice, *FSSamplecollectionSetter]("", "fs_samplecollection", buildFSSamplecollectionColumns("fs_samplecollection")) + +// FSSamplecollectionsQuery is a query on the fs_samplecollection table +type FSSamplecollectionsQuery = *psql.ViewQuery[*FSSamplecollection, FSSamplecollectionSlice] + +// fsSamplecollectionR is where relationships are stored. +type fsSamplecollectionR struct { + Organization *Organization // fs_samplecollection.fs_samplecollection_organization_id_fkey +} + +func buildFSSamplecollectionColumns(alias string) fsSamplecollectionColumns { + return fsSamplecollectionColumns{ + 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", "updated", + ).WithParent("fs_samplecollection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Avetemp: psql.Quote(alias, "avetemp"), + Chickenid: psql.Quote(alias, "chickenid"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datesent: psql.Quote(alias, "datesent"), + Datetested: psql.Quote(alias, "datetested"), + Diseasepos: psql.Quote(alias, "diseasepos"), + Diseasetested: psql.Quote(alias, "diseasetested"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Flockid: psql.Quote(alias, "flockid"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Lab: psql.Quote(alias, "lab"), + Locationname: psql.Quote(alias, "locationname"), + LocID: psql.Quote(alias, "loc_id"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Samplecond: psql.Quote(alias, "samplecond"), + Samplecount: psql.Quote(alias, "samplecount"), + Sampleid: psql.Quote(alias, "sampleid"), + Sampletype: psql.Quote(alias, "sampletype"), + Sex: psql.Quote(alias, "sex"), + Sitecond: psql.Quote(alias, "sitecond"), + Species: psql.Quote(alias, "species"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Survtech: psql.Quote(alias, "survtech"), + Testmethod: psql.Quote(alias, "testmethod"), + Testtech: psql.Quote(alias, "testtech"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsSamplecollectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Avetemp psql.Expression + Chickenid psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datesent psql.Expression + Datetested psql.Expression + Diseasepos psql.Expression + Diseasetested psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Flockid psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Lab psql.Expression + Locationname psql.Expression + LocID psql.Expression + Objectid psql.Expression + Processed psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Samplecond psql.Expression + Samplecount psql.Expression + Sampleid psql.Expression + Sampletype psql.Expression + Sex psql.Expression + Sitecond psql.Expression + Species psql.Expression + Startdatetime psql.Expression + Survtech psql.Expression + Testmethod psql.Expression + Testtech psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsSamplecollectionColumns) Alias() string { + return c.tableAlias +} + +func (fsSamplecollectionColumns) AliasedAs(alias string) fsSamplecollectionColumns { + return buildFSSamplecollectionColumns(alias) +} + +// FSSamplecollectionSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSSamplecollectionSetter) SetColumns() []string { + vals := make([]string, 0, 50) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Chickenid.IsUnset() { + vals = append(vals, "chickenid") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datesent.IsUnset() { + vals = append(vals, "datesent") + } + if !s.Datetested.IsUnset() { + vals = append(vals, "datetested") + } + if !s.Diseasepos.IsUnset() { + vals = append(vals, "diseasepos") + } + if !s.Diseasetested.IsUnset() { + vals = append(vals, "diseasetested") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Flockid.IsUnset() { + vals = append(vals, "flockid") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lab.IsUnset() { + vals = append(vals, "lab") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LocID.IsUnset() { + vals = append(vals, "loc_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Samplecond.IsUnset() { + vals = append(vals, "samplecond") + } + if !s.Samplecount.IsUnset() { + vals = append(vals, "samplecount") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.Sampletype.IsUnset() { + vals = append(vals, "sampletype") + } + if !s.Sex.IsUnset() { + vals = append(vals, "sex") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Survtech.IsUnset() { + vals = append(vals, "survtech") + } + if !s.Testmethod.IsUnset() { + vals = append(vals, "testmethod") + } + if !s.Testtech.IsUnset() { + vals = append(vals, "testtech") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSSamplecollectionSetter) Overwrite(t *FSSamplecollection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Chickenid.IsUnset() { + t.Chickenid = s.Chickenid.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datesent.IsUnset() { + t.Datesent = s.Datesent.MustGetNull() + } + if !s.Datetested.IsUnset() { + t.Datetested = s.Datetested.MustGetNull() + } + if !s.Diseasepos.IsUnset() { + t.Diseasepos = s.Diseasepos.MustGetNull() + } + if !s.Diseasetested.IsUnset() { + t.Diseasetested = s.Diseasetested.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Flockid.IsUnset() { + t.Flockid = s.Flockid.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lab.IsUnset() { + t.Lab = s.Lab.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LocID.IsUnset() { + t.LocID = s.LocID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Samplecond.IsUnset() { + t.Samplecond = s.Samplecond.MustGetNull() + } + if !s.Samplecount.IsUnset() { + t.Samplecount = s.Samplecount.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.Sampletype.IsUnset() { + t.Sampletype = s.Sampletype.MustGetNull() + } + if !s.Sex.IsUnset() { + t.Sex = s.Sex.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Survtech.IsUnset() { + t.Survtech = s.Survtech.MustGetNull() + } + if !s.Testmethod.IsUnset() { + t.Testmethod = s.Testmethod.MustGetNull() + } + if !s.Testtech.IsUnset() { + t.Testtech = s.Testtech.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSSamplecollectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSSamplecollections.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, 50) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[2] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Chickenid.IsUnset() { + vals[3] = psql.Arg(s.Chickenid.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Datesent.IsUnset() { + vals[7] = psql.Arg(s.Datesent.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Datetested.IsUnset() { + vals[8] = psql.Arg(s.Datetested.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Diseasepos.IsUnset() { + vals[9] = psql.Arg(s.Diseasepos.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Diseasetested.IsUnset() { + vals[10] = psql.Arg(s.Diseasetested.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[11] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[12] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[13] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Flockid.IsUnset() { + vals[15] = psql.Arg(s.Flockid.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[16] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[17] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lab.IsUnset() { + vals[18] = psql.Arg(s.Lab.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[19] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LocID.IsUnset() { + vals[20] = psql.Arg(s.LocID.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[21] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[22] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[23] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[24] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[25] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[26] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[27] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Samplecond.IsUnset() { + vals[28] = psql.Arg(s.Samplecond.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Samplecount.IsUnset() { + vals[29] = psql.Arg(s.Samplecount.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[30] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Sampletype.IsUnset() { + vals[31] = psql.Arg(s.Sampletype.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Sex.IsUnset() { + vals[32] = psql.Arg(s.Sex.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[33] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[34] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[35] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Survtech.IsUnset() { + vals[36] = psql.Arg(s.Survtech.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Testmethod.IsUnset() { + vals[37] = psql.Arg(s.Testmethod.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Testtech.IsUnset() { + vals[38] = psql.Arg(s.Testtech.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[39] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[40] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[41] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[42] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[43] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[44] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[45] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[46] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[47] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[48] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[49] = psql.Arg(s.Updated.MustGet()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSSamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSSamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 50) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Chickenid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "chickenid")...), + psql.Arg(s.Chickenid), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datesent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datesent")...), + psql.Arg(s.Datesent), + }}) + } + + if !s.Datetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetested")...), + psql.Arg(s.Datetested), + }}) + } + + if !s.Diseasepos.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasepos")...), + psql.Arg(s.Diseasepos), + }}) + } + + if !s.Diseasetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasetested")...), + psql.Arg(s.Diseasetested), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Flockid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flockid")...), + psql.Arg(s.Flockid), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lab.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab")...), + psql.Arg(s.Lab), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LocID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "loc_id")...), + psql.Arg(s.LocID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Samplecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplecond")...), + psql.Arg(s.Samplecond), + }}) + } + + if !s.Samplecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplecount")...), + psql.Arg(s.Samplecount), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.Sampletype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampletype")...), + psql.Arg(s.Sampletype), + }}) + } + + if !s.Sex.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sex")...), + psql.Arg(s.Sex), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Survtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "survtech")...), + psql.Arg(s.Survtech), + }}) + } + + if !s.Testmethod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testmethod")...), + psql.Arg(s.Testmethod), + }}) + } + + if !s.Testtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testtech")...), + psql.Arg(s.Testtech), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSSamplecollection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSSamplecollection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSamplecollection, error) { + if len(cols) == 0 { + return FSSamplecollections.Query( + sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSSamplecollections.Query( + sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSSamplecollections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSSamplecollectionExists checks the presence of a single record by primary key +func FSSamplecollectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSSamplecollections.Query( + sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSSamplecollection is retrieved from the database +func (o *FSSamplecollection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSamplecollections.AfterSelectHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSSamplecollections.AfterInsertHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSSamplecollection +func (o *FSSamplecollection) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSSamplecollection) pkEQ() dialect.Expression { + return psql.Quote("fs_samplecollection", "objectid").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 FSSamplecollection +func (o *FSSamplecollection) Update(ctx context.Context, exec bob.Executor, s *FSSamplecollectionSetter) error { + v, err := FSSamplecollections.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 FSSamplecollection record with an executor +func (o *FSSamplecollection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSSamplecollections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSSamplecollection using the executor +func (o *FSSamplecollection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSSamplecollections.Query( + sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSSamplecollectionSlice is retrieved from the database +func (o FSSamplecollectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSamplecollections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSSamplecollections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSSamplecollectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_samplecollection", "objectid").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 FSSamplecollectionSlice) copyMatchingRows(from ...*FSSamplecollection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSSamplecollectionSlice) 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 FSSamplecollections.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 *FSSamplecollection: + o.copyMatchingRows(retrieved) + case []*FSSamplecollection: + o.copyMatchingRows(retrieved...) + case FSSamplecollectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSamplecollection or a slice of FSSamplecollection + // then run the AfterUpdateHooks on the slice + _, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSSamplecollectionSlice) 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 FSSamplecollections.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 *FSSamplecollection: + o.copyMatchingRows(retrieved) + case []*FSSamplecollection: + o.copyMatchingRows(retrieved...) + case FSSamplecollectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSamplecollection or a slice of FSSamplecollection + // then run the AfterDeleteHooks on the slice + _, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSSamplecollectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSamplecollectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSSamplecollections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSSamplecollectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSSamplecollections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSSamplecollectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSSamplecollections.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 *FSSamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSSamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSSamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplecollection0 *FSSamplecollection, organization1 *Organization) (*FSSamplecollection, error) { + setter := &FSSamplecollectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsSamplecollection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSSamplecollectionOrganization0: %w", err) + } + + return fsSamplecollection0, nil +} + +func (fsSamplecollection0 *FSSamplecollection) 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 = attachFSSamplecollectionOrganization0(ctx, exec, 1, fsSamplecollection0, organization1) + if err != nil { + return err + } + + fsSamplecollection0.R.Organization = organization1 + + organization1.R.FSSamplecollections = append(organization1.R.FSSamplecollections, fsSamplecollection0) + + return nil +} + +func (fsSamplecollection0 *FSSamplecollection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSSamplecollectionOrganization0(ctx, exec, 1, fsSamplecollection0, organization1) + if err != nil { + return err + } + + fsSamplecollection0.R.Organization = organization1 + + organization1.R.FSSamplecollections = append(organization1.R.FSSamplecollections, fsSamplecollection0) + + return nil +} + +type fsSamplecollectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Chickenid psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datesent psql.WhereNullMod[Q, int64] + Datetested psql.WhereNullMod[Q, int64] + Diseasepos psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Flockid psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Lab psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LocID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Samplecond psql.WhereNullMod[Q, string] + Samplecount psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + Sampletype psql.WhereNullMod[Q, string] + Sex psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Species psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Survtech psql.WhereNullMod[Q, string] + Testmethod psql.WhereNullMod[Q, string] + Testtech psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsSamplecollectionWhere[Q]) AliasedAs(alias string) fsSamplecollectionWhere[Q] { + return buildFSSamplecollectionWhere[Q](buildFSSamplecollectionColumns(alias)) +} + +func buildFSSamplecollectionWhere[Q psql.Filterable](cols fsSamplecollectionColumns) fsSamplecollectionWhere[Q] { + return fsSamplecollectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Datesent: psql.WhereNull[Q, int64](cols.Datesent), + Datetested: psql.WhereNull[Q, int64](cols.Datetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Flockid: psql.WhereNull[Q, string](cols.Flockid), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lab: psql.WhereNull[Q, string](cols.Lab), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LocID: psql.WhereNull[Q, string](cols.LocID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Samplecond: psql.WhereNull[Q, string](cols.Samplecond), + Samplecount: psql.WhereNull[Q, int16](cols.Samplecount), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + Sampletype: psql.WhereNull[Q, string](cols.Sampletype), + Sex: psql.WhereNull[Q, string](cols.Sex), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Species: psql.WhereNull[Q, string](cols.Species), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Survtech: psql.WhereNull[Q, string](cols.Survtech), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Testtech: psql.WhereNull[Q, string](cols.Testtech), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSSamplecollection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsSamplecollection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSSamplecollections = FSSamplecollectionSlice{o} + } + return nil + default: + return fmt.Errorf("fsSamplecollection has no relationship %q", name) + } +} + +type fsSamplecollectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSSamplecollectionPreloader() fsSamplecollectionPreloader { + return fsSamplecollectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSSamplecollections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsSamplecollectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSSamplecollectionThenLoader[Q orm.Loadable]() fsSamplecollectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsSamplecollectionThenLoader[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 fsSamplecollection's Organization into the .R struct +func (o *FSSamplecollection) 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.FSSamplecollections = FSSamplecollectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsSamplecollection's Organization into the .R struct +func (os FSSamplecollectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSSamplecollections = append(rel.R.FSSamplecollections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsSamplecollectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsSamplecollectionJoins[Q]) aliasedAs(alias string) fsSamplecollectionJoins[Q] { + return buildFSSamplecollectionJoins[Q](buildFSSamplecollectionColumns(alias), j.typ) +} + +func buildFSSamplecollectionJoins[Q dialect.Joinable](cols fsSamplecollectionColumns, typ string) fsSamplecollectionJoins[Q] { + return fsSamplecollectionJoins[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_samplelocation.bob.go b/models/fs_samplelocation.bob.go new file mode 100644 index 00000000..04f4c604 --- /dev/null +++ b/models/fs_samplelocation.bob.go @@ -0,0 +1,1258 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSSamplelocation is an object representing the database table. +type FSSamplelocation 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" ` + Updated time.Time `db:"updated" ` + + R fsSamplelocationR `db:"-" ` +} + +// FSSamplelocationSlice is an alias for a slice of pointers to FSSamplelocation. +// This should almost always be used instead of []*FSSamplelocation. +type FSSamplelocationSlice []*FSSamplelocation + +// FSSamplelocations contains methods to work with the fs_samplelocation table +var FSSamplelocations = psql.NewTablex[*FSSamplelocation, FSSamplelocationSlice, *FSSamplelocationSetter]("", "fs_samplelocation", buildFSSamplelocationColumns("fs_samplelocation")) + +// FSSamplelocationsQuery is a query on the fs_samplelocation table +type FSSamplelocationsQuery = *psql.ViewQuery[*FSSamplelocation, FSSamplelocationSlice] + +// fsSamplelocationR is where relationships are stored. +type fsSamplelocationR struct { + Organization *Organization // fs_samplelocation.fs_samplelocation_organization_id_fkey +} + +func buildFSSamplelocationColumns(alias string) fsSamplelocationColumns { + return fsSamplelocationColumns{ + 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", "updated", + ).WithParent("fs_samplelocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsSamplelocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsSamplelocationColumns) Alias() string { + return c.tableAlias +} + +func (fsSamplelocationColumns) AliasedAs(alias string) fsSamplelocationColumns { + return buildFSSamplelocationColumns(alias) +} + +// FSSamplelocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSSamplelocationSetter) SetColumns() []string { + vals := make([]string, 0, 28) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSSamplelocationSetter) Overwrite(t *FSSamplelocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSSamplelocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSSamplelocations.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, 28) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[14] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[17] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[18] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[19] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[20] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[27] = psql.Arg(s.Updated.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSSamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSSamplelocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 28) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSSamplelocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSSamplelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSamplelocation, error) { + if len(cols) == 0 { + return FSSamplelocations.Query( + sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSSamplelocations.Query( + sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSSamplelocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSSamplelocationExists checks the presence of a single record by primary key +func FSSamplelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSSamplelocations.Query( + sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSSamplelocation is retrieved from the database +func (o *FSSamplelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSamplelocations.AfterSelectHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSSamplelocations.AfterInsertHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSSamplelocation +func (o *FSSamplelocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSSamplelocation) pkEQ() dialect.Expression { + return psql.Quote("fs_samplelocation", "objectid").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 FSSamplelocation +func (o *FSSamplelocation) Update(ctx context.Context, exec bob.Executor, s *FSSamplelocationSetter) error { + v, err := FSSamplelocations.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 FSSamplelocation record with an executor +func (o *FSSamplelocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSSamplelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSSamplelocation using the executor +func (o *FSSamplelocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSSamplelocations.Query( + sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSSamplelocationSlice is retrieved from the database +func (o FSSamplelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSamplelocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSSamplelocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSSamplelocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_samplelocation", "objectid").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 FSSamplelocationSlice) copyMatchingRows(from ...*FSSamplelocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSSamplelocationSlice) 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 FSSamplelocations.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 *FSSamplelocation: + o.copyMatchingRows(retrieved) + case []*FSSamplelocation: + o.copyMatchingRows(retrieved...) + case FSSamplelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSamplelocation or a slice of FSSamplelocation + // then run the AfterUpdateHooks on the slice + _, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSSamplelocationSlice) 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 FSSamplelocations.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 *FSSamplelocation: + o.copyMatchingRows(retrieved) + case []*FSSamplelocation: + o.copyMatchingRows(retrieved...) + case FSSamplelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSamplelocation or a slice of FSSamplelocation + // then run the AfterDeleteHooks on the slice + _, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSSamplelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSamplelocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSSamplelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSSamplelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSSamplelocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSSamplelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSSamplelocations.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 *FSSamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSSamplelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSSamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplelocation0 *FSSamplelocation, organization1 *Organization) (*FSSamplelocation, error) { + setter := &FSSamplelocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsSamplelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSSamplelocationOrganization0: %w", err) + } + + return fsSamplelocation0, nil +} + +func (fsSamplelocation0 *FSSamplelocation) 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 = attachFSSamplelocationOrganization0(ctx, exec, 1, fsSamplelocation0, organization1) + if err != nil { + return err + } + + fsSamplelocation0.R.Organization = organization1 + + organization1.R.FSSamplelocations = append(organization1.R.FSSamplelocations, fsSamplelocation0) + + return nil +} + +func (fsSamplelocation0 *FSSamplelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSSamplelocationOrganization0(ctx, exec, 1, fsSamplelocation0, organization1) + if err != nil { + return err + } + + fsSamplelocation0.R.Organization = organization1 + + organization1.R.FSSamplelocations = append(organization1.R.FSSamplelocations, fsSamplelocation0) + + return nil +} + +type fsSamplelocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsSamplelocationWhere[Q]) AliasedAs(alias string) fsSamplelocationWhere[Q] { + return buildFSSamplelocationWhere[Q](buildFSSamplelocationColumns(alias)) +} + +func buildFSSamplelocationWhere[Q psql.Filterable](cols fsSamplelocationColumns) fsSamplelocationWhere[Q] { + return fsSamplelocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSSamplelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsSamplelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSSamplelocations = FSSamplelocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsSamplelocation has no relationship %q", name) + } +} + +type fsSamplelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSSamplelocationPreloader() fsSamplelocationPreloader { + return fsSamplelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSSamplelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsSamplelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSSamplelocationThenLoader[Q orm.Loadable]() fsSamplelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsSamplelocationThenLoader[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 fsSamplelocation's Organization into the .R struct +func (o *FSSamplelocation) 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.FSSamplelocations = FSSamplelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsSamplelocation's Organization into the .R struct +func (os FSSamplelocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSSamplelocations = append(rel.R.FSSamplelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsSamplelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsSamplelocationJoins[Q]) aliasedAs(alias string) fsSamplelocationJoins[Q] { + return buildFSSamplelocationJoins[Q](buildFSSamplelocationColumns(alias), j.typ) +} + +func buildFSSamplelocationJoins[Q dialect.Joinable](cols fsSamplelocationColumns, typ string) fsSamplelocationJoins[Q] { + return fsSamplelocationJoins[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_servicerequest.bob.go b/models/fs_servicerequest.bob.go new file mode 100644 index 00000000..9367b693 --- /dev/null +++ b/models/fs_servicerequest.bob.go @@ -0,0 +1,2808 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSServicerequest is an object representing the database table. +type FSServicerequest 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" ` + Updated time.Time `db:"updated" ` + + R fsServicerequestR `db:"-" ` +} + +// FSServicerequestSlice is an alias for a slice of pointers to FSServicerequest. +// This should almost always be used instead of []*FSServicerequest. +type FSServicerequestSlice []*FSServicerequest + +// FSServicerequests contains methods to work with the fs_servicerequest table +var FSServicerequests = psql.NewTablex[*FSServicerequest, FSServicerequestSlice, *FSServicerequestSetter]("", "fs_servicerequest", buildFSServicerequestColumns("fs_servicerequest")) + +// FSServicerequestsQuery is a query on the fs_servicerequest table +type FSServicerequestsQuery = *psql.ViewQuery[*FSServicerequest, FSServicerequestSlice] + +// fsServicerequestR is where relationships are stored. +type fsServicerequestR struct { + Organization *Organization // fs_servicerequest.fs_servicerequest_organization_id_fkey +} + +func buildFSServicerequestColumns(alias string) fsServicerequestColumns { + return fsServicerequestColumns{ + 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", "updated", + ).WithParent("fs_servicerequest"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accepted: psql.Quote(alias, "accepted"), + Acceptedby: psql.Quote(alias, "acceptedby"), + Accepteddate: psql.Quote(alias, "accepteddate"), + Allowed: psql.Quote(alias, "allowed"), + Assignedtech: psql.Quote(alias, "assignedtech"), + Clraddr1: psql.Quote(alias, "clraddr1"), + Clraddr2: psql.Quote(alias, "clraddr2"), + Clranon: psql.Quote(alias, "clranon"), + Clrcity: psql.Quote(alias, "clrcity"), + Clrcompany: psql.Quote(alias, "clrcompany"), + Clrcontpref: psql.Quote(alias, "clrcontpref"), + Clremail: psql.Quote(alias, "clremail"), + Clrfname: psql.Quote(alias, "clrfname"), + Clrother: psql.Quote(alias, "clrother"), + Clrphone1: psql.Quote(alias, "clrphone1"), + Clrphone2: psql.Quote(alias, "clrphone2"), + Clrstate: psql.Quote(alias, "clrstate"), + Clrzip: psql.Quote(alias, "clrzip"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datetimeclosed: psql.Quote(alias, "datetimeclosed"), + Duedate: psql.Quote(alias, "duedate"), + Entrytech: psql.Quote(alias, "entrytech"), + Estcompletedate: psql.Quote(alias, "estcompletedate"), + Externalerror: psql.Quote(alias, "externalerror"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Firstresponsedate: psql.Quote(alias, "firstresponsedate"), + Globalid: psql.Quote(alias, "globalid"), + Issuesreported: psql.Quote(alias, "issuesreported"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Nextaction: psql.Quote(alias, "nextaction"), + Notificationtimestamp: psql.Quote(alias, "notificationtimestamp"), + Notified: psql.Quote(alias, "notified"), + Notifieddate: psql.Quote(alias, "notifieddate"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Priority: psql.Quote(alias, "priority"), + Recdatetime: psql.Quote(alias, "recdatetime"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Rejectedby: psql.Quote(alias, "rejectedby"), + Rejecteddate: psql.Quote(alias, "rejecteddate"), + Rejectedreason: psql.Quote(alias, "rejectedreason"), + Reqaddr1: psql.Quote(alias, "reqaddr1"), + Reqaddr2: psql.Quote(alias, "reqaddr2"), + Reqcity: psql.Quote(alias, "reqcity"), + Reqcompany: psql.Quote(alias, "reqcompany"), + Reqcrossst: psql.Quote(alias, "reqcrossst"), + Reqdescr: psql.Quote(alias, "reqdescr"), + Reqfldnotes: psql.Quote(alias, "reqfldnotes"), + Reqmapgrid: psql.Quote(alias, "reqmapgrid"), + Reqnotesforcust: psql.Quote(alias, "reqnotesforcust"), + Reqnotesfortech: psql.Quote(alias, "reqnotesfortech"), + Reqpermission: psql.Quote(alias, "reqpermission"), + Reqprogramactions: psql.Quote(alias, "reqprogramactions"), + Reqstate: psql.Quote(alias, "reqstate"), + Reqsubdiv: psql.Quote(alias, "reqsubdiv"), + Reqtarget: psql.Quote(alias, "reqtarget"), + Reqzip: psql.Quote(alias, "reqzip"), + Responsedaycount: psql.Quote(alias, "responsedaycount"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Scheduled: psql.Quote(alias, "scheduled"), + Scheduleddate: psql.Quote(alias, "scheduleddate"), + Source: psql.Quote(alias, "source"), + SRNumber: psql.Quote(alias, "sr_number"), + Status: psql.Quote(alias, "status"), + Supervisor: psql.Quote(alias, "supervisor"), + Techclosed: psql.Quote(alias, "techclosed"), + Validx: psql.Quote(alias, "validx"), + Validy: psql.Quote(alias, "validy"), + Xvalue: psql.Quote(alias, "xvalue"), + Yvalue: psql.Quote(alias, "yvalue"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Dog: psql.Quote(alias, "dog"), + Spanish: psql.Quote(alias, "spanish"), + ScheduleNotes: psql.Quote(alias, "schedule_notes"), + SchedulePeriod: psql.Quote(alias, "schedule_period"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsServicerequestColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accepted psql.Expression + Acceptedby psql.Expression + Accepteddate psql.Expression + Allowed psql.Expression + Assignedtech psql.Expression + Clraddr1 psql.Expression + Clraddr2 psql.Expression + Clranon psql.Expression + Clrcity psql.Expression + Clrcompany psql.Expression + Clrcontpref psql.Expression + Clremail psql.Expression + Clrfname psql.Expression + Clrother psql.Expression + Clrphone1 psql.Expression + Clrphone2 psql.Expression + Clrstate psql.Expression + Clrzip psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datetimeclosed psql.Expression + Duedate psql.Expression + Entrytech psql.Expression + Estcompletedate psql.Expression + Externalerror psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Firstresponsedate psql.Expression + Globalid psql.Expression + Issuesreported psql.Expression + Jurisdiction psql.Expression + Nextaction psql.Expression + Notificationtimestamp psql.Expression + Notified psql.Expression + Notifieddate psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Priority psql.Expression + Recdatetime psql.Expression + Recordstatus psql.Expression + Rejectedby psql.Expression + Rejecteddate psql.Expression + Rejectedreason psql.Expression + Reqaddr1 psql.Expression + Reqaddr2 psql.Expression + Reqcity psql.Expression + Reqcompany psql.Expression + Reqcrossst psql.Expression + Reqdescr psql.Expression + Reqfldnotes psql.Expression + Reqmapgrid psql.Expression + Reqnotesforcust psql.Expression + Reqnotesfortech psql.Expression + Reqpermission psql.Expression + Reqprogramactions psql.Expression + Reqstate psql.Expression + Reqsubdiv psql.Expression + Reqtarget psql.Expression + Reqzip psql.Expression + Responsedaycount psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Scheduled psql.Expression + Scheduleddate psql.Expression + Source psql.Expression + SRNumber psql.Expression + Status psql.Expression + Supervisor psql.Expression + Techclosed psql.Expression + Validx psql.Expression + Validy psql.Expression + Xvalue psql.Expression + Yvalue psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Dog psql.Expression + Spanish psql.Expression + ScheduleNotes psql.Expression + SchedulePeriod psql.Expression + Updated psql.Expression +} + +func (c fsServicerequestColumns) Alias() string { + return c.tableAlias +} + +func (fsServicerequestColumns) AliasedAs(alias string) fsServicerequestColumns { + return buildFSServicerequestColumns(alias) +} + +// FSServicerequestSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSServicerequestSetter) SetColumns() []string { + vals := make([]string, 0, 90) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accepted.IsUnset() { + vals = append(vals, "accepted") + } + if !s.Acceptedby.IsUnset() { + vals = append(vals, "acceptedby") + } + if !s.Accepteddate.IsUnset() { + vals = append(vals, "accepteddate") + } + if !s.Allowed.IsUnset() { + vals = append(vals, "allowed") + } + if !s.Assignedtech.IsUnset() { + vals = append(vals, "assignedtech") + } + if !s.Clraddr1.IsUnset() { + vals = append(vals, "clraddr1") + } + if !s.Clraddr2.IsUnset() { + vals = append(vals, "clraddr2") + } + if !s.Clranon.IsUnset() { + vals = append(vals, "clranon") + } + if !s.Clrcity.IsUnset() { + vals = append(vals, "clrcity") + } + if !s.Clrcompany.IsUnset() { + vals = append(vals, "clrcompany") + } + if !s.Clrcontpref.IsUnset() { + vals = append(vals, "clrcontpref") + } + if !s.Clremail.IsUnset() { + vals = append(vals, "clremail") + } + if !s.Clrfname.IsUnset() { + vals = append(vals, "clrfname") + } + if !s.Clrother.IsUnset() { + vals = append(vals, "clrother") + } + if !s.Clrphone1.IsUnset() { + vals = append(vals, "clrphone1") + } + if !s.Clrphone2.IsUnset() { + vals = append(vals, "clrphone2") + } + if !s.Clrstate.IsUnset() { + vals = append(vals, "clrstate") + } + if !s.Clrzip.IsUnset() { + vals = append(vals, "clrzip") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datetimeclosed.IsUnset() { + vals = append(vals, "datetimeclosed") + } + if !s.Duedate.IsUnset() { + vals = append(vals, "duedate") + } + if !s.Entrytech.IsUnset() { + vals = append(vals, "entrytech") + } + if !s.Estcompletedate.IsUnset() { + vals = append(vals, "estcompletedate") + } + if !s.Externalerror.IsUnset() { + vals = append(vals, "externalerror") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Firstresponsedate.IsUnset() { + vals = append(vals, "firstresponsedate") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Issuesreported.IsUnset() { + vals = append(vals, "issuesreported") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Nextaction.IsUnset() { + vals = append(vals, "nextaction") + } + if !s.Notificationtimestamp.IsUnset() { + vals = append(vals, "notificationtimestamp") + } + if !s.Notified.IsUnset() { + vals = append(vals, "notified") + } + if !s.Notifieddate.IsUnset() { + vals = append(vals, "notifieddate") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Recdatetime.IsUnset() { + vals = append(vals, "recdatetime") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Rejectedby.IsUnset() { + vals = append(vals, "rejectedby") + } + if !s.Rejecteddate.IsUnset() { + vals = append(vals, "rejecteddate") + } + if !s.Rejectedreason.IsUnset() { + vals = append(vals, "rejectedreason") + } + if !s.Reqaddr1.IsUnset() { + vals = append(vals, "reqaddr1") + } + if !s.Reqaddr2.IsUnset() { + vals = append(vals, "reqaddr2") + } + if !s.Reqcity.IsUnset() { + vals = append(vals, "reqcity") + } + if !s.Reqcompany.IsUnset() { + vals = append(vals, "reqcompany") + } + if !s.Reqcrossst.IsUnset() { + vals = append(vals, "reqcrossst") + } + if !s.Reqdescr.IsUnset() { + vals = append(vals, "reqdescr") + } + if !s.Reqfldnotes.IsUnset() { + vals = append(vals, "reqfldnotes") + } + if !s.Reqmapgrid.IsUnset() { + vals = append(vals, "reqmapgrid") + } + if !s.Reqnotesforcust.IsUnset() { + vals = append(vals, "reqnotesforcust") + } + if !s.Reqnotesfortech.IsUnset() { + vals = append(vals, "reqnotesfortech") + } + if !s.Reqpermission.IsUnset() { + vals = append(vals, "reqpermission") + } + if !s.Reqprogramactions.IsUnset() { + vals = append(vals, "reqprogramactions") + } + if !s.Reqstate.IsUnset() { + vals = append(vals, "reqstate") + } + if !s.Reqsubdiv.IsUnset() { + vals = append(vals, "reqsubdiv") + } + if !s.Reqtarget.IsUnset() { + vals = append(vals, "reqtarget") + } + if !s.Reqzip.IsUnset() { + vals = append(vals, "reqzip") + } + if !s.Responsedaycount.IsUnset() { + vals = append(vals, "responsedaycount") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Scheduled.IsUnset() { + vals = append(vals, "scheduled") + } + if !s.Scheduleddate.IsUnset() { + vals = append(vals, "scheduleddate") + } + if !s.Source.IsUnset() { + vals = append(vals, "source") + } + if !s.SRNumber.IsUnset() { + vals = append(vals, "sr_number") + } + if !s.Status.IsUnset() { + vals = append(vals, "status") + } + if !s.Supervisor.IsUnset() { + vals = append(vals, "supervisor") + } + if !s.Techclosed.IsUnset() { + vals = append(vals, "techclosed") + } + if !s.Validx.IsUnset() { + vals = append(vals, "validx") + } + if !s.Validy.IsUnset() { + vals = append(vals, "validy") + } + if !s.Xvalue.IsUnset() { + vals = append(vals, "xvalue") + } + if !s.Yvalue.IsUnset() { + vals = append(vals, "yvalue") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Dog.IsUnset() { + vals = append(vals, "dog") + } + if !s.Spanish.IsUnset() { + vals = append(vals, "spanish") + } + if !s.ScheduleNotes.IsUnset() { + vals = append(vals, "schedule_notes") + } + if !s.SchedulePeriod.IsUnset() { + vals = append(vals, "schedule_period") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSServicerequestSetter) Overwrite(t *FSServicerequest) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accepted.IsUnset() { + t.Accepted = s.Accepted.MustGetNull() + } + if !s.Acceptedby.IsUnset() { + t.Acceptedby = s.Acceptedby.MustGetNull() + } + if !s.Accepteddate.IsUnset() { + t.Accepteddate = s.Accepteddate.MustGetNull() + } + if !s.Allowed.IsUnset() { + t.Allowed = s.Allowed.MustGetNull() + } + if !s.Assignedtech.IsUnset() { + t.Assignedtech = s.Assignedtech.MustGetNull() + } + if !s.Clraddr1.IsUnset() { + t.Clraddr1 = s.Clraddr1.MustGetNull() + } + if !s.Clraddr2.IsUnset() { + t.Clraddr2 = s.Clraddr2.MustGetNull() + } + if !s.Clranon.IsUnset() { + t.Clranon = s.Clranon.MustGetNull() + } + if !s.Clrcity.IsUnset() { + t.Clrcity = s.Clrcity.MustGetNull() + } + if !s.Clrcompany.IsUnset() { + t.Clrcompany = s.Clrcompany.MustGetNull() + } + if !s.Clrcontpref.IsUnset() { + t.Clrcontpref = s.Clrcontpref.MustGetNull() + } + if !s.Clremail.IsUnset() { + t.Clremail = s.Clremail.MustGetNull() + } + if !s.Clrfname.IsUnset() { + t.Clrfname = s.Clrfname.MustGetNull() + } + if !s.Clrother.IsUnset() { + t.Clrother = s.Clrother.MustGetNull() + } + if !s.Clrphone1.IsUnset() { + t.Clrphone1 = s.Clrphone1.MustGetNull() + } + if !s.Clrphone2.IsUnset() { + t.Clrphone2 = s.Clrphone2.MustGetNull() + } + if !s.Clrstate.IsUnset() { + t.Clrstate = s.Clrstate.MustGetNull() + } + if !s.Clrzip.IsUnset() { + t.Clrzip = s.Clrzip.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datetimeclosed.IsUnset() { + t.Datetimeclosed = s.Datetimeclosed.MustGetNull() + } + if !s.Duedate.IsUnset() { + t.Duedate = s.Duedate.MustGetNull() + } + if !s.Entrytech.IsUnset() { + t.Entrytech = s.Entrytech.MustGetNull() + } + if !s.Estcompletedate.IsUnset() { + t.Estcompletedate = s.Estcompletedate.MustGetNull() + } + if !s.Externalerror.IsUnset() { + t.Externalerror = s.Externalerror.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Firstresponsedate.IsUnset() { + t.Firstresponsedate = s.Firstresponsedate.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Issuesreported.IsUnset() { + t.Issuesreported = s.Issuesreported.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Nextaction.IsUnset() { + t.Nextaction = s.Nextaction.MustGetNull() + } + if !s.Notificationtimestamp.IsUnset() { + t.Notificationtimestamp = s.Notificationtimestamp.MustGetNull() + } + if !s.Notified.IsUnset() { + t.Notified = s.Notified.MustGetNull() + } + if !s.Notifieddate.IsUnset() { + t.Notifieddate = s.Notifieddate.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Recdatetime.IsUnset() { + t.Recdatetime = s.Recdatetime.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Rejectedby.IsUnset() { + t.Rejectedby = s.Rejectedby.MustGetNull() + } + if !s.Rejecteddate.IsUnset() { + t.Rejecteddate = s.Rejecteddate.MustGetNull() + } + if !s.Rejectedreason.IsUnset() { + t.Rejectedreason = s.Rejectedreason.MustGetNull() + } + if !s.Reqaddr1.IsUnset() { + t.Reqaddr1 = s.Reqaddr1.MustGetNull() + } + if !s.Reqaddr2.IsUnset() { + t.Reqaddr2 = s.Reqaddr2.MustGetNull() + } + if !s.Reqcity.IsUnset() { + t.Reqcity = s.Reqcity.MustGetNull() + } + if !s.Reqcompany.IsUnset() { + t.Reqcompany = s.Reqcompany.MustGetNull() + } + if !s.Reqcrossst.IsUnset() { + t.Reqcrossst = s.Reqcrossst.MustGetNull() + } + if !s.Reqdescr.IsUnset() { + t.Reqdescr = s.Reqdescr.MustGetNull() + } + if !s.Reqfldnotes.IsUnset() { + t.Reqfldnotes = s.Reqfldnotes.MustGetNull() + } + if !s.Reqmapgrid.IsUnset() { + t.Reqmapgrid = s.Reqmapgrid.MustGetNull() + } + if !s.Reqnotesforcust.IsUnset() { + t.Reqnotesforcust = s.Reqnotesforcust.MustGetNull() + } + if !s.Reqnotesfortech.IsUnset() { + t.Reqnotesfortech = s.Reqnotesfortech.MustGetNull() + } + if !s.Reqpermission.IsUnset() { + t.Reqpermission = s.Reqpermission.MustGetNull() + } + if !s.Reqprogramactions.IsUnset() { + t.Reqprogramactions = s.Reqprogramactions.MustGetNull() + } + if !s.Reqstate.IsUnset() { + t.Reqstate = s.Reqstate.MustGetNull() + } + if !s.Reqsubdiv.IsUnset() { + t.Reqsubdiv = s.Reqsubdiv.MustGetNull() + } + if !s.Reqtarget.IsUnset() { + t.Reqtarget = s.Reqtarget.MustGetNull() + } + if !s.Reqzip.IsUnset() { + t.Reqzip = s.Reqzip.MustGetNull() + } + if !s.Responsedaycount.IsUnset() { + t.Responsedaycount = s.Responsedaycount.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Scheduled.IsUnset() { + t.Scheduled = s.Scheduled.MustGetNull() + } + if !s.Scheduleddate.IsUnset() { + t.Scheduleddate = s.Scheduleddate.MustGetNull() + } + if !s.Source.IsUnset() { + t.Source = s.Source.MustGetNull() + } + if !s.SRNumber.IsUnset() { + t.SRNumber = s.SRNumber.MustGetNull() + } + if !s.Status.IsUnset() { + t.Status = s.Status.MustGetNull() + } + if !s.Supervisor.IsUnset() { + t.Supervisor = s.Supervisor.MustGetNull() + } + if !s.Techclosed.IsUnset() { + t.Techclosed = s.Techclosed.MustGetNull() + } + if !s.Validx.IsUnset() { + t.Validx = s.Validx.MustGetNull() + } + if !s.Validy.IsUnset() { + t.Validy = s.Validy.MustGetNull() + } + if !s.Xvalue.IsUnset() { + t.Xvalue = s.Xvalue.MustGetNull() + } + if !s.Yvalue.IsUnset() { + t.Yvalue = s.Yvalue.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Dog.IsUnset() { + t.Dog = s.Dog.MustGetNull() + } + if !s.Spanish.IsUnset() { + t.Spanish = s.Spanish.MustGetNull() + } + if !s.ScheduleNotes.IsUnset() { + t.ScheduleNotes = s.ScheduleNotes.MustGetNull() + } + if !s.SchedulePeriod.IsUnset() { + t.SchedulePeriod = s.SchedulePeriod.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSServicerequestSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSServicerequests.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, 90) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accepted.IsUnset() { + vals[1] = psql.Arg(s.Accepted.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acceptedby.IsUnset() { + vals[2] = psql.Arg(s.Acceptedby.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Accepteddate.IsUnset() { + vals[3] = psql.Arg(s.Accepteddate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Allowed.IsUnset() { + vals[4] = psql.Arg(s.Allowed.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Assignedtech.IsUnset() { + vals[5] = psql.Arg(s.Assignedtech.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Clraddr1.IsUnset() { + vals[6] = psql.Arg(s.Clraddr1.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Clraddr2.IsUnset() { + vals[7] = psql.Arg(s.Clraddr2.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Clranon.IsUnset() { + vals[8] = psql.Arg(s.Clranon.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Clrcity.IsUnset() { + vals[9] = psql.Arg(s.Clrcity.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Clrcompany.IsUnset() { + vals[10] = psql.Arg(s.Clrcompany.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Clrcontpref.IsUnset() { + vals[11] = psql.Arg(s.Clrcontpref.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Clremail.IsUnset() { + vals[12] = psql.Arg(s.Clremail.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Clrfname.IsUnset() { + vals[13] = psql.Arg(s.Clrfname.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Clrother.IsUnset() { + vals[14] = psql.Arg(s.Clrother.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Clrphone1.IsUnset() { + vals[15] = psql.Arg(s.Clrphone1.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Clrphone2.IsUnset() { + vals[16] = psql.Arg(s.Clrphone2.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Clrstate.IsUnset() { + vals[17] = psql.Arg(s.Clrstate.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Clrzip.IsUnset() { + vals[18] = psql.Arg(s.Clrzip.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[19] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[20] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[21] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Datetimeclosed.IsUnset() { + vals[22] = psql.Arg(s.Datetimeclosed.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Duedate.IsUnset() { + vals[23] = psql.Arg(s.Duedate.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Entrytech.IsUnset() { + vals[24] = psql.Arg(s.Entrytech.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Estcompletedate.IsUnset() { + vals[25] = psql.Arg(s.Estcompletedate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Externalerror.IsUnset() { + vals[26] = psql.Arg(s.Externalerror.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[27] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[28] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[29] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Firstresponsedate.IsUnset() { + vals[30] = psql.Arg(s.Firstresponsedate.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[31] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Issuesreported.IsUnset() { + vals[32] = psql.Arg(s.Issuesreported.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Nextaction.IsUnset() { + vals[34] = psql.Arg(s.Nextaction.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Notificationtimestamp.IsUnset() { + vals[35] = psql.Arg(s.Notificationtimestamp.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Notified.IsUnset() { + vals[36] = psql.Arg(s.Notified.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Notifieddate.IsUnset() { + vals[37] = psql.Arg(s.Notifieddate.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[38] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[39] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[40] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Recdatetime.IsUnset() { + vals[41] = psql.Arg(s.Recdatetime.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[42] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Rejectedby.IsUnset() { + vals[43] = psql.Arg(s.Rejectedby.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Rejecteddate.IsUnset() { + vals[44] = psql.Arg(s.Rejecteddate.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Rejectedreason.IsUnset() { + vals[45] = psql.Arg(s.Rejectedreason.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Reqaddr1.IsUnset() { + vals[46] = psql.Arg(s.Reqaddr1.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Reqaddr2.IsUnset() { + vals[47] = psql.Arg(s.Reqaddr2.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Reqcity.IsUnset() { + vals[48] = psql.Arg(s.Reqcity.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Reqcompany.IsUnset() { + vals[49] = psql.Arg(s.Reqcompany.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Reqcrossst.IsUnset() { + vals[50] = psql.Arg(s.Reqcrossst.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Reqdescr.IsUnset() { + vals[51] = psql.Arg(s.Reqdescr.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Reqfldnotes.IsUnset() { + vals[52] = psql.Arg(s.Reqfldnotes.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Reqmapgrid.IsUnset() { + vals[53] = psql.Arg(s.Reqmapgrid.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.Reqnotesforcust.IsUnset() { + vals[54] = psql.Arg(s.Reqnotesforcust.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.Reqnotesfortech.IsUnset() { + vals[55] = psql.Arg(s.Reqnotesfortech.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.Reqpermission.IsUnset() { + vals[56] = psql.Arg(s.Reqpermission.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.Reqprogramactions.IsUnset() { + vals[57] = psql.Arg(s.Reqprogramactions.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Reqstate.IsUnset() { + vals[58] = psql.Arg(s.Reqstate.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.Reqsubdiv.IsUnset() { + vals[59] = psql.Arg(s.Reqsubdiv.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if !s.Reqtarget.IsUnset() { + vals[60] = psql.Arg(s.Reqtarget.MustGetNull()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + if !s.Reqzip.IsUnset() { + vals[61] = psql.Arg(s.Reqzip.MustGetNull()) + } else { + vals[61] = psql.Raw("DEFAULT") + } + + if !s.Responsedaycount.IsUnset() { + vals[62] = psql.Arg(s.Responsedaycount.MustGetNull()) + } else { + vals[62] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[63] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[63] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[64] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[64] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[65] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[65] = psql.Raw("DEFAULT") + } + + if !s.Scheduled.IsUnset() { + vals[66] = psql.Arg(s.Scheduled.MustGetNull()) + } else { + vals[66] = psql.Raw("DEFAULT") + } + + if !s.Scheduleddate.IsUnset() { + vals[67] = psql.Arg(s.Scheduleddate.MustGetNull()) + } else { + vals[67] = psql.Raw("DEFAULT") + } + + if !s.Source.IsUnset() { + vals[68] = psql.Arg(s.Source.MustGetNull()) + } else { + vals[68] = psql.Raw("DEFAULT") + } + + if !s.SRNumber.IsUnset() { + vals[69] = psql.Arg(s.SRNumber.MustGetNull()) + } else { + vals[69] = psql.Raw("DEFAULT") + } + + if !s.Status.IsUnset() { + vals[70] = psql.Arg(s.Status.MustGetNull()) + } else { + vals[70] = psql.Raw("DEFAULT") + } + + if !s.Supervisor.IsUnset() { + vals[71] = psql.Arg(s.Supervisor.MustGetNull()) + } else { + vals[71] = psql.Raw("DEFAULT") + } + + if !s.Techclosed.IsUnset() { + vals[72] = psql.Arg(s.Techclosed.MustGetNull()) + } else { + vals[72] = psql.Raw("DEFAULT") + } + + if !s.Validx.IsUnset() { + vals[73] = psql.Arg(s.Validx.MustGetNull()) + } else { + vals[73] = psql.Raw("DEFAULT") + } + + if !s.Validy.IsUnset() { + vals[74] = psql.Arg(s.Validy.MustGetNull()) + } else { + vals[74] = psql.Raw("DEFAULT") + } + + if !s.Xvalue.IsUnset() { + vals[75] = psql.Arg(s.Xvalue.MustGetNull()) + } else { + vals[75] = psql.Raw("DEFAULT") + } + + if !s.Yvalue.IsUnset() { + vals[76] = psql.Arg(s.Yvalue.MustGetNull()) + } else { + vals[76] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[77] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[77] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[78] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[78] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[79] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[79] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[80] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[80] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[81] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[81] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[82] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[82] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[83] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[83] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[84] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[84] = psql.Raw("DEFAULT") + } + + if !s.Dog.IsUnset() { + vals[85] = psql.Arg(s.Dog.MustGetNull()) + } else { + vals[85] = psql.Raw("DEFAULT") + } + + if !s.Spanish.IsUnset() { + vals[86] = psql.Arg(s.Spanish.MustGetNull()) + } else { + vals[86] = psql.Raw("DEFAULT") + } + + if !s.ScheduleNotes.IsUnset() { + vals[87] = psql.Arg(s.ScheduleNotes.MustGetNull()) + } else { + vals[87] = psql.Raw("DEFAULT") + } + + if !s.SchedulePeriod.IsUnset() { + vals[88] = psql.Arg(s.SchedulePeriod.MustGetNull()) + } else { + vals[88] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[89] = psql.Arg(s.Updated.MustGet()) + } else { + vals[89] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSServicerequestSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 90) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accepted.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accepted")...), + psql.Arg(s.Accepted), + }}) + } + + if !s.Acceptedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acceptedby")...), + psql.Arg(s.Acceptedby), + }}) + } + + if !s.Accepteddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accepteddate")...), + psql.Arg(s.Accepteddate), + }}) + } + + if !s.Allowed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "allowed")...), + psql.Arg(s.Allowed), + }}) + } + + if !s.Assignedtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "assignedtech")...), + psql.Arg(s.Assignedtech), + }}) + } + + if !s.Clraddr1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clraddr1")...), + psql.Arg(s.Clraddr1), + }}) + } + + if !s.Clraddr2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clraddr2")...), + psql.Arg(s.Clraddr2), + }}) + } + + if !s.Clranon.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clranon")...), + psql.Arg(s.Clranon), + }}) + } + + if !s.Clrcity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcity")...), + psql.Arg(s.Clrcity), + }}) + } + + if !s.Clrcompany.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcompany")...), + psql.Arg(s.Clrcompany), + }}) + } + + if !s.Clrcontpref.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcontpref")...), + psql.Arg(s.Clrcontpref), + }}) + } + + if !s.Clremail.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clremail")...), + psql.Arg(s.Clremail), + }}) + } + + if !s.Clrfname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrfname")...), + psql.Arg(s.Clrfname), + }}) + } + + if !s.Clrother.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrother")...), + psql.Arg(s.Clrother), + }}) + } + + if !s.Clrphone1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrphone1")...), + psql.Arg(s.Clrphone1), + }}) + } + + if !s.Clrphone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrphone2")...), + psql.Arg(s.Clrphone2), + }}) + } + + if !s.Clrstate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrstate")...), + psql.Arg(s.Clrstate), + }}) + } + + if !s.Clrzip.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrzip")...), + psql.Arg(s.Clrzip), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datetimeclosed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetimeclosed")...), + psql.Arg(s.Datetimeclosed), + }}) + } + + if !s.Duedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "duedate")...), + psql.Arg(s.Duedate), + }}) + } + + if !s.Entrytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "entrytech")...), + psql.Arg(s.Entrytech), + }}) + } + + if !s.Estcompletedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "estcompletedate")...), + psql.Arg(s.Estcompletedate), + }}) + } + + if !s.Externalerror.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalerror")...), + psql.Arg(s.Externalerror), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Firstresponsedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "firstresponsedate")...), + psql.Arg(s.Firstresponsedate), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Issuesreported.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "issuesreported")...), + psql.Arg(s.Issuesreported), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Nextaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextaction")...), + psql.Arg(s.Nextaction), + }}) + } + + if !s.Notificationtimestamp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notificationtimestamp")...), + psql.Arg(s.Notificationtimestamp), + }}) + } + + if !s.Notified.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notified")...), + psql.Arg(s.Notified), + }}) + } + + if !s.Notifieddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notifieddate")...), + psql.Arg(s.Notifieddate), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Recdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recdatetime")...), + psql.Arg(s.Recdatetime), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Rejectedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejectedby")...), + psql.Arg(s.Rejectedby), + }}) + } + + if !s.Rejecteddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejecteddate")...), + psql.Arg(s.Rejecteddate), + }}) + } + + if !s.Rejectedreason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejectedreason")...), + psql.Arg(s.Rejectedreason), + }}) + } + + if !s.Reqaddr1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqaddr1")...), + psql.Arg(s.Reqaddr1), + }}) + } + + if !s.Reqaddr2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqaddr2")...), + psql.Arg(s.Reqaddr2), + }}) + } + + if !s.Reqcity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcity")...), + psql.Arg(s.Reqcity), + }}) + } + + if !s.Reqcompany.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcompany")...), + psql.Arg(s.Reqcompany), + }}) + } + + if !s.Reqcrossst.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcrossst")...), + psql.Arg(s.Reqcrossst), + }}) + } + + if !s.Reqdescr.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqdescr")...), + psql.Arg(s.Reqdescr), + }}) + } + + if !s.Reqfldnotes.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqfldnotes")...), + psql.Arg(s.Reqfldnotes), + }}) + } + + if !s.Reqmapgrid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqmapgrid")...), + psql.Arg(s.Reqmapgrid), + }}) + } + + if !s.Reqnotesforcust.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqnotesforcust")...), + psql.Arg(s.Reqnotesforcust), + }}) + } + + if !s.Reqnotesfortech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqnotesfortech")...), + psql.Arg(s.Reqnotesfortech), + }}) + } + + if !s.Reqpermission.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqpermission")...), + psql.Arg(s.Reqpermission), + }}) + } + + if !s.Reqprogramactions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqprogramactions")...), + psql.Arg(s.Reqprogramactions), + }}) + } + + if !s.Reqstate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqstate")...), + psql.Arg(s.Reqstate), + }}) + } + + if !s.Reqsubdiv.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqsubdiv")...), + psql.Arg(s.Reqsubdiv), + }}) + } + + if !s.Reqtarget.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqtarget")...), + psql.Arg(s.Reqtarget), + }}) + } + + if !s.Reqzip.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqzip")...), + psql.Arg(s.Reqzip), + }}) + } + + if !s.Responsedaycount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "responsedaycount")...), + psql.Arg(s.Responsedaycount), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Scheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scheduled")...), + psql.Arg(s.Scheduled), + }}) + } + + if !s.Scheduleddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scheduleddate")...), + psql.Arg(s.Scheduleddate), + }}) + } + + if !s.Source.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "source")...), + psql.Arg(s.Source), + }}) + } + + if !s.SRNumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sr_number")...), + psql.Arg(s.SRNumber), + }}) + } + + if !s.Status.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "status")...), + psql.Arg(s.Status), + }}) + } + + if !s.Supervisor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "supervisor")...), + psql.Arg(s.Supervisor), + }}) + } + + if !s.Techclosed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "techclosed")...), + psql.Arg(s.Techclosed), + }}) + } + + if !s.Validx.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "validx")...), + psql.Arg(s.Validx), + }}) + } + + if !s.Validy.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "validy")...), + psql.Arg(s.Validy), + }}) + } + + if !s.Xvalue.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "xvalue")...), + psql.Arg(s.Xvalue), + }}) + } + + if !s.Yvalue.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "yvalue")...), + psql.Arg(s.Yvalue), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Dog.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "dog")...), + psql.Arg(s.Dog), + }}) + } + + if !s.Spanish.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "spanish")...), + psql.Arg(s.Spanish), + }}) + } + + if !s.ScheduleNotes.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "schedule_notes")...), + psql.Arg(s.ScheduleNotes), + }}) + } + + if !s.SchedulePeriod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "schedule_period")...), + psql.Arg(s.SchedulePeriod), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSServicerequest retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSServicerequest(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSServicerequest, error) { + if len(cols) == 0 { + return FSServicerequests.Query( + sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSServicerequests.Query( + sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSServicerequests.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSServicerequestExists checks the presence of a single record by primary key +func FSServicerequestExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSServicerequests.Query( + sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSServicerequest is retrieved from the database +func (o *FSServicerequest) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSServicerequests.AfterSelectHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSServicerequests.AfterInsertHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSServicerequest +func (o *FSServicerequest) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSServicerequest) pkEQ() dialect.Expression { + return psql.Quote("fs_servicerequest", "objectid").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 FSServicerequest +func (o *FSServicerequest) Update(ctx context.Context, exec bob.Executor, s *FSServicerequestSetter) error { + v, err := FSServicerequests.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 FSServicerequest record with an executor +func (o *FSServicerequest) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSServicerequests.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSServicerequest using the executor +func (o *FSServicerequest) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSServicerequests.Query( + sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSServicerequestSlice is retrieved from the database +func (o FSServicerequestSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSServicerequests.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSServicerequests.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSServicerequestSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_servicerequest", "objectid").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 FSServicerequestSlice) copyMatchingRows(from ...*FSServicerequest) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSServicerequestSlice) 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 FSServicerequests.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 *FSServicerequest: + o.copyMatchingRows(retrieved) + case []*FSServicerequest: + o.copyMatchingRows(retrieved...) + case FSServicerequestSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSServicerequest or a slice of FSServicerequest + // then run the AfterUpdateHooks on the slice + _, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSServicerequestSlice) 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 FSServicerequests.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 *FSServicerequest: + o.copyMatchingRows(retrieved) + case []*FSServicerequest: + o.copyMatchingRows(retrieved...) + case FSServicerequestSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSServicerequest or a slice of FSServicerequest + // then run the AfterDeleteHooks on the slice + _, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSServicerequestSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSServicerequestSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSServicerequests.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSServicerequestSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSServicerequests.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSServicerequestSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSServicerequests.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 *FSServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSServicerequestSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, fsServicerequest0 *FSServicerequest, organization1 *Organization) (*FSServicerequest, error) { + setter := &FSServicerequestSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsServicerequest0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSServicerequestOrganization0: %w", err) + } + + return fsServicerequest0, nil +} + +func (fsServicerequest0 *FSServicerequest) 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 = attachFSServicerequestOrganization0(ctx, exec, 1, fsServicerequest0, organization1) + if err != nil { + return err + } + + fsServicerequest0.R.Organization = organization1 + + organization1.R.FSServicerequests = append(organization1.R.FSServicerequests, fsServicerequest0) + + return nil +} + +func (fsServicerequest0 *FSServicerequest) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSServicerequestOrganization0(ctx, exec, 1, fsServicerequest0, organization1) + if err != nil { + return err + } + + fsServicerequest0.R.Organization = organization1 + + organization1.R.FSServicerequests = append(organization1.R.FSServicerequests, fsServicerequest0) + + return nil +} + +type fsServicerequestWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accepted psql.WhereNullMod[Q, int16] + Acceptedby psql.WhereNullMod[Q, string] + Accepteddate psql.WhereNullMod[Q, int64] + Allowed psql.WhereNullMod[Q, string] + Assignedtech psql.WhereNullMod[Q, string] + Clraddr1 psql.WhereNullMod[Q, string] + Clraddr2 psql.WhereNullMod[Q, string] + Clranon psql.WhereNullMod[Q, int16] + Clrcity psql.WhereNullMod[Q, string] + Clrcompany psql.WhereNullMod[Q, string] + Clrcontpref psql.WhereNullMod[Q, string] + Clremail psql.WhereNullMod[Q, string] + Clrfname psql.WhereNullMod[Q, string] + Clrother psql.WhereNullMod[Q, string] + Clrphone1 psql.WhereNullMod[Q, string] + Clrphone2 psql.WhereNullMod[Q, string] + Clrstate psql.WhereNullMod[Q, string] + Clrzip psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datetimeclosed psql.WhereNullMod[Q, int64] + Duedate psql.WhereNullMod[Q, int64] + Entrytech psql.WhereNullMod[Q, string] + Estcompletedate psql.WhereNullMod[Q, int64] + Externalerror psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Firstresponsedate psql.WhereNullMod[Q, int64] + Globalid psql.WhereNullMod[Q, string] + Issuesreported psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Nextaction psql.WhereNullMod[Q, string] + Notificationtimestamp psql.WhereNullMod[Q, string] + Notified psql.WhereNullMod[Q, int16] + Notifieddate psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Recdatetime psql.WhereNullMod[Q, int64] + Recordstatus psql.WhereNullMod[Q, int16] + Rejectedby psql.WhereNullMod[Q, string] + Rejecteddate psql.WhereNullMod[Q, int64] + Rejectedreason psql.WhereNullMod[Q, string] + Reqaddr1 psql.WhereNullMod[Q, string] + Reqaddr2 psql.WhereNullMod[Q, string] + Reqcity psql.WhereNullMod[Q, string] + Reqcompany psql.WhereNullMod[Q, string] + Reqcrossst psql.WhereNullMod[Q, string] + Reqdescr psql.WhereNullMod[Q, string] + Reqfldnotes psql.WhereNullMod[Q, string] + Reqmapgrid psql.WhereNullMod[Q, string] + Reqnotesforcust psql.WhereNullMod[Q, string] + Reqnotesfortech psql.WhereNullMod[Q, string] + Reqpermission psql.WhereNullMod[Q, int16] + Reqprogramactions psql.WhereNullMod[Q, string] + Reqstate psql.WhereNullMod[Q, string] + Reqsubdiv psql.WhereNullMod[Q, string] + Reqtarget psql.WhereNullMod[Q, string] + Reqzip psql.WhereNullMod[Q, string] + Responsedaycount psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Scheduled psql.WhereNullMod[Q, int16] + Scheduleddate psql.WhereNullMod[Q, int64] + Source psql.WhereNullMod[Q, string] + SRNumber psql.WhereNullMod[Q, int64] + Status psql.WhereNullMod[Q, string] + Supervisor psql.WhereNullMod[Q, string] + Techclosed psql.WhereNullMod[Q, string] + Validx psql.WhereNullMod[Q, string] + Validy psql.WhereNullMod[Q, string] + Xvalue psql.WhereNullMod[Q, string] + Yvalue psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Dog psql.WhereNullMod[Q, int64] + Spanish psql.WhereNullMod[Q, int64] + ScheduleNotes psql.WhereNullMod[Q, string] + SchedulePeriod psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsServicerequestWhere[Q]) AliasedAs(alias string) fsServicerequestWhere[Q] { + return buildFSServicerequestWhere[Q](buildFSServicerequestColumns(alias)) +} + +func buildFSServicerequestWhere[Q psql.Filterable](cols fsServicerequestColumns) fsServicerequestWhere[Q] { + return fsServicerequestWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Allowed: psql.WhereNull[Q, string](cols.Allowed), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), + Clraddr1: psql.WhereNull[Q, string](cols.Clraddr1), + Clraddr2: psql.WhereNull[Q, string](cols.Clraddr2), + Clranon: psql.WhereNull[Q, int16](cols.Clranon), + Clrcity: psql.WhereNull[Q, string](cols.Clrcity), + Clrcompany: psql.WhereNull[Q, string](cols.Clrcompany), + Clrcontpref: psql.WhereNull[Q, string](cols.Clrcontpref), + Clremail: psql.WhereNull[Q, string](cols.Clremail), + Clrfname: psql.WhereNull[Q, string](cols.Clrfname), + Clrother: psql.WhereNull[Q, string](cols.Clrother), + Clrphone1: psql.WhereNull[Q, string](cols.Clrphone1), + Clrphone2: psql.WhereNull[Q, string](cols.Clrphone2), + Clrstate: psql.WhereNull[Q, string](cols.Clrstate), + Clrzip: psql.WhereNull[Q, string](cols.Clrzip), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Datetimeclosed: psql.WhereNull[Q, int64](cols.Datetimeclosed), + Duedate: psql.WhereNull[Q, int64](cols.Duedate), + Entrytech: psql.WhereNull[Q, string](cols.Entrytech), + Estcompletedate: psql.WhereNull[Q, int64](cols.Estcompletedate), + Externalerror: psql.WhereNull[Q, string](cols.Externalerror), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Firstresponsedate: psql.WhereNull[Q, int64](cols.Firstresponsedate), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Issuesreported: psql.WhereNull[Q, string](cols.Issuesreported), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Nextaction: psql.WhereNull[Q, string](cols.Nextaction), + Notificationtimestamp: psql.WhereNull[Q, string](cols.Notificationtimestamp), + Notified: psql.WhereNull[Q, int16](cols.Notified), + Notifieddate: psql.WhereNull[Q, int64](cols.Notifieddate), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Recdatetime: psql.WhereNull[Q, int64](cols.Recdatetime), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Rejectedby: psql.WhereNull[Q, string](cols.Rejectedby), + Rejecteddate: psql.WhereNull[Q, int64](cols.Rejecteddate), + Rejectedreason: psql.WhereNull[Q, string](cols.Rejectedreason), + Reqaddr1: psql.WhereNull[Q, string](cols.Reqaddr1), + Reqaddr2: psql.WhereNull[Q, string](cols.Reqaddr2), + Reqcity: psql.WhereNull[Q, string](cols.Reqcity), + Reqcompany: psql.WhereNull[Q, string](cols.Reqcompany), + Reqcrossst: psql.WhereNull[Q, string](cols.Reqcrossst), + Reqdescr: psql.WhereNull[Q, string](cols.Reqdescr), + Reqfldnotes: psql.WhereNull[Q, string](cols.Reqfldnotes), + Reqmapgrid: psql.WhereNull[Q, string](cols.Reqmapgrid), + Reqnotesforcust: psql.WhereNull[Q, string](cols.Reqnotesforcust), + Reqnotesfortech: psql.WhereNull[Q, string](cols.Reqnotesfortech), + Reqpermission: psql.WhereNull[Q, int16](cols.Reqpermission), + Reqprogramactions: psql.WhereNull[Q, string](cols.Reqprogramactions), + Reqstate: psql.WhereNull[Q, string](cols.Reqstate), + Reqsubdiv: psql.WhereNull[Q, string](cols.Reqsubdiv), + Reqtarget: psql.WhereNull[Q, string](cols.Reqtarget), + Reqzip: psql.WhereNull[Q, string](cols.Reqzip), + Responsedaycount: psql.WhereNull[Q, int16](cols.Responsedaycount), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Scheduled: psql.WhereNull[Q, int16](cols.Scheduled), + Scheduleddate: psql.WhereNull[Q, int64](cols.Scheduleddate), + Source: psql.WhereNull[Q, string](cols.Source), + SRNumber: psql.WhereNull[Q, int64](cols.SRNumber), + Status: psql.WhereNull[Q, string](cols.Status), + Supervisor: psql.WhereNull[Q, string](cols.Supervisor), + Techclosed: psql.WhereNull[Q, string](cols.Techclosed), + Validx: psql.WhereNull[Q, string](cols.Validx), + Validy: psql.WhereNull[Q, string](cols.Validy), + Xvalue: psql.WhereNull[Q, string](cols.Xvalue), + Yvalue: psql.WhereNull[Q, string](cols.Yvalue), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Dog: psql.WhereNull[Q, int64](cols.Dog), + Spanish: psql.WhereNull[Q, int64](cols.Spanish), + ScheduleNotes: psql.WhereNull[Q, string](cols.ScheduleNotes), + SchedulePeriod: psql.WhereNull[Q, string](cols.SchedulePeriod), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSServicerequest) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsServicerequest cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSServicerequests = FSServicerequestSlice{o} + } + return nil + default: + return fmt.Errorf("fsServicerequest has no relationship %q", name) + } +} + +type fsServicerequestPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSServicerequestPreloader() fsServicerequestPreloader { + return fsServicerequestPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSServicerequests, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsServicerequestThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSServicerequestThenLoader[Q orm.Loadable]() fsServicerequestThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsServicerequestThenLoader[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 fsServicerequest's Organization into the .R struct +func (o *FSServicerequest) 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.FSServicerequests = FSServicerequestSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsServicerequest's Organization into the .R struct +func (os FSServicerequestSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSServicerequests = append(rel.R.FSServicerequests, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsServicerequestJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsServicerequestJoins[Q]) aliasedAs(alias string) fsServicerequestJoins[Q] { + return buildFSServicerequestJoins[Q](buildFSServicerequestColumns(alias), j.typ) +} + +func buildFSServicerequestJoins[Q dialect.Joinable](cols fsServicerequestColumns, typ string) fsServicerequestJoins[Q] { + return fsServicerequestJoins[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_speciesabundance.bob.go b/models/fs_speciesabundance.bob.go new file mode 100644 index 00000000..f45b2515 --- /dev/null +++ b/models/fs_speciesabundance.bob.go @@ -0,0 +1,1383 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSSpeciesabundance is an object representing the database table. +type FSSpeciesabundance 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" ` + Updated time.Time `db:"updated" ` + + R fsSpeciesabundanceR `db:"-" ` +} + +// FSSpeciesabundanceSlice is an alias for a slice of pointers to FSSpeciesabundance. +// This should almost always be used instead of []*FSSpeciesabundance. +type FSSpeciesabundanceSlice []*FSSpeciesabundance + +// FSSpeciesabundances contains methods to work with the fs_speciesabundance table +var FSSpeciesabundances = psql.NewTablex[*FSSpeciesabundance, FSSpeciesabundanceSlice, *FSSpeciesabundanceSetter]("", "fs_speciesabundance", buildFSSpeciesabundanceColumns("fs_speciesabundance")) + +// FSSpeciesabundancesQuery is a query on the fs_speciesabundance table +type FSSpeciesabundancesQuery = *psql.ViewQuery[*FSSpeciesabundance, FSSpeciesabundanceSlice] + +// fsSpeciesabundanceR is where relationships are stored. +type fsSpeciesabundanceR struct { + Organization *Organization // fs_speciesabundance.fs_speciesabundance_organization_id_fkey +} + +func buildFSSpeciesabundanceColumns(alias string) fsSpeciesabundanceColumns { + return fsSpeciesabundanceColumns{ + 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", "updated", + ).WithParent("fs_speciesabundance"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Bloodedfem: psql.Quote(alias, "bloodedfem"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Eggs: psql.Quote(alias, "eggs"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Females: psql.Quote(alias, "females"), + Gravidfem: psql.Quote(alias, "gravidfem"), + Globalid: psql.Quote(alias, "globalid"), + Larvae: psql.Quote(alias, "larvae"), + Males: psql.Quote(alias, "males"), + Objectid: psql.Quote(alias, "objectid"), + Poolstogen: psql.Quote(alias, "poolstogen"), + Processed: psql.Quote(alias, "processed"), + Pupae: psql.Quote(alias, "pupae"), + Species: psql.Quote(alias, "species"), + Total: psql.Quote(alias, "total"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + Unknown: psql.Quote(alias, "unknown"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Globalzscore: psql.Quote(alias, "globalzscore"), + H3R7: psql.Quote(alias, "h3r7"), + H3R8: psql.Quote(alias, "h3r8"), + R7score: psql.Quote(alias, "r7score"), + R8score: psql.Quote(alias, "r8score"), + Yearweek: psql.Quote(alias, "yearweek"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsSpeciesabundanceColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Bloodedfem psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Eggs psql.Expression + Editdate psql.Expression + Editor psql.Expression + Females psql.Expression + Gravidfem psql.Expression + Globalid psql.Expression + Larvae psql.Expression + Males psql.Expression + Objectid psql.Expression + Poolstogen psql.Expression + Processed psql.Expression + Pupae psql.Expression + Species psql.Expression + Total psql.Expression + TrapdataID psql.Expression + Unknown psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Globalzscore psql.Expression + H3R7 psql.Expression + H3R8 psql.Expression + R7score psql.Expression + R8score psql.Expression + Yearweek psql.Expression + Updated psql.Expression +} + +func (c fsSpeciesabundanceColumns) Alias() string { + return c.tableAlias +} + +func (fsSpeciesabundanceColumns) AliasedAs(alias string) fsSpeciesabundanceColumns { + return buildFSSpeciesabundanceColumns(alias) +} + +// FSSpeciesabundanceSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSSpeciesabundanceSetter) SetColumns() []string { + vals := make([]string, 0, 33) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Bloodedfem.IsUnset() { + vals = append(vals, "bloodedfem") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Eggs.IsUnset() { + vals = append(vals, "eggs") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Females.IsUnset() { + vals = append(vals, "females") + } + if !s.Gravidfem.IsUnset() { + vals = append(vals, "gravidfem") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Larvae.IsUnset() { + vals = append(vals, "larvae") + } + if !s.Males.IsUnset() { + vals = append(vals, "males") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Poolstogen.IsUnset() { + vals = append(vals, "poolstogen") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Pupae.IsUnset() { + vals = append(vals, "pupae") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.Total.IsUnset() { + vals = append(vals, "total") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.Unknown.IsUnset() { + vals = append(vals, "unknown") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Globalzscore.IsUnset() { + vals = append(vals, "globalzscore") + } + if !s.H3R7.IsUnset() { + vals = append(vals, "h3r7") + } + if !s.H3R8.IsUnset() { + vals = append(vals, "h3r8") + } + if !s.R7score.IsUnset() { + vals = append(vals, "r7score") + } + if !s.R8score.IsUnset() { + vals = append(vals, "r8score") + } + if !s.Yearweek.IsUnset() { + vals = append(vals, "yearweek") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSSpeciesabundanceSetter) Overwrite(t *FSSpeciesabundance) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Bloodedfem.IsUnset() { + t.Bloodedfem = s.Bloodedfem.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Eggs.IsUnset() { + t.Eggs = s.Eggs.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Females.IsUnset() { + t.Females = s.Females.MustGetNull() + } + if !s.Gravidfem.IsUnset() { + t.Gravidfem = s.Gravidfem.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Larvae.IsUnset() { + t.Larvae = s.Larvae.MustGetNull() + } + if !s.Males.IsUnset() { + t.Males = s.Males.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Poolstogen.IsUnset() { + t.Poolstogen = s.Poolstogen.MustGetNull() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Pupae.IsUnset() { + t.Pupae = s.Pupae.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.Total.IsUnset() { + t.Total = s.Total.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.Unknown.IsUnset() { + t.Unknown = s.Unknown.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Globalzscore.IsUnset() { + t.Globalzscore = s.Globalzscore.MustGetNull() + } + if !s.H3R7.IsUnset() { + t.H3R7 = s.H3R7.MustGetNull() + } + if !s.H3R8.IsUnset() { + t.H3R8 = s.H3R8.MustGetNull() + } + if !s.R7score.IsUnset() { + t.R7score = s.R7score.MustGetNull() + } + if !s.R8score.IsUnset() { + t.R8score = s.R8score.MustGetNull() + } + if !s.Yearweek.IsUnset() { + t.Yearweek = s.Yearweek.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSSpeciesabundances.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, 33) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Bloodedfem.IsUnset() { + vals[1] = psql.Arg(s.Bloodedfem.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Eggs.IsUnset() { + vals[4] = psql.Arg(s.Eggs.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[5] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[6] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Females.IsUnset() { + vals[7] = psql.Arg(s.Females.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Gravidfem.IsUnset() { + vals[8] = psql.Arg(s.Gravidfem.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[9] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Larvae.IsUnset() { + vals[10] = psql.Arg(s.Larvae.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Males.IsUnset() { + vals[11] = psql.Arg(s.Males.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[12] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Poolstogen.IsUnset() { + vals[13] = psql.Arg(s.Poolstogen.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[14] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Pupae.IsUnset() { + vals[15] = psql.Arg(s.Pupae.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[16] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Total.IsUnset() { + vals[17] = psql.Arg(s.Total.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[18] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Unknown.IsUnset() { + vals[19] = psql.Arg(s.Unknown.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[20] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[21] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[22] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[23] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[24] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[25] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Globalzscore.IsUnset() { + vals[26] = psql.Arg(s.Globalzscore.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.H3R7.IsUnset() { + vals[27] = psql.Arg(s.H3R7.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.H3R8.IsUnset() { + vals[28] = psql.Arg(s.H3R8.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.R7score.IsUnset() { + vals[29] = psql.Arg(s.R7score.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.R8score.IsUnset() { + vals[30] = psql.Arg(s.R8score.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Yearweek.IsUnset() { + vals[31] = psql.Arg(s.Yearweek.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[32] = psql.Arg(s.Updated.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSSpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSSpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 33) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Bloodedfem.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "bloodedfem")...), + psql.Arg(s.Bloodedfem), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Eggs.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "eggs")...), + psql.Arg(s.Eggs), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Females.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "females")...), + psql.Arg(s.Females), + }}) + } + + if !s.Gravidfem.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gravidfem")...), + psql.Arg(s.Gravidfem), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Larvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvae")...), + psql.Arg(s.Larvae), + }}) + } + + if !s.Males.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "males")...), + psql.Arg(s.Males), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Poolstogen.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "poolstogen")...), + psql.Arg(s.Poolstogen), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Pupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pupae")...), + psql.Arg(s.Pupae), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.Total.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "total")...), + psql.Arg(s.Total), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.Unknown.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "unknown")...), + psql.Arg(s.Unknown), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Globalzscore.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalzscore")...), + psql.Arg(s.Globalzscore), + }}) + } + + if !s.H3R7.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r7")...), + psql.Arg(s.H3R7), + }}) + } + + if !s.H3R8.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r8")...), + psql.Arg(s.H3R8), + }}) + } + + if !s.R7score.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "r7score")...), + psql.Arg(s.R7score), + }}) + } + + if !s.R8score.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "r8score")...), + psql.Arg(s.R8score), + }}) + } + + if !s.Yearweek.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "yearweek")...), + psql.Arg(s.Yearweek), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSSpeciesabundance retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSSpeciesabundance(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSpeciesabundance, error) { + if len(cols) == 0 { + return FSSpeciesabundances.Query( + sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSSpeciesabundances.Query( + sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSSpeciesabundances.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSSpeciesabundanceExists checks the presence of a single record by primary key +func FSSpeciesabundanceExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSSpeciesabundances.Query( + sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSSpeciesabundance is retrieved from the database +func (o *FSSpeciesabundance) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSSpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSSpeciesabundance +func (o *FSSpeciesabundance) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSSpeciesabundance) pkEQ() dialect.Expression { + return psql.Quote("fs_speciesabundance", "objectid").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 FSSpeciesabundance +func (o *FSSpeciesabundance) Update(ctx context.Context, exec bob.Executor, s *FSSpeciesabundanceSetter) error { + v, err := FSSpeciesabundances.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 FSSpeciesabundance record with an executor +func (o *FSSpeciesabundance) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSSpeciesabundances.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSSpeciesabundance using the executor +func (o *FSSpeciesabundance) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSSpeciesabundances.Query( + sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSSpeciesabundanceSlice is retrieved from the database +func (o FSSpeciesabundanceSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSSpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSSpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSSpeciesabundanceSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_speciesabundance", "objectid").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 FSSpeciesabundanceSlice) copyMatchingRows(from ...*FSSpeciesabundance) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSSpeciesabundanceSlice) 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 FSSpeciesabundances.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 *FSSpeciesabundance: + o.copyMatchingRows(retrieved) + case []*FSSpeciesabundance: + o.copyMatchingRows(retrieved...) + case FSSpeciesabundanceSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSpeciesabundance or a slice of FSSpeciesabundance + // then run the AfterUpdateHooks on the slice + _, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSSpeciesabundanceSlice) 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 FSSpeciesabundances.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 *FSSpeciesabundance: + o.copyMatchingRows(retrieved) + case []*FSSpeciesabundance: + o.copyMatchingRows(retrieved...) + case FSSpeciesabundanceSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSSpeciesabundance or a slice of FSSpeciesabundance + // then run the AfterDeleteHooks on the slice + _, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSSpeciesabundanceSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSpeciesabundanceSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSSpeciesabundances.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSSpeciesabundanceSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSSpeciesabundances.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSSpeciesabundanceSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSSpeciesabundances.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 *FSSpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSSpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSSpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundance0 *FSSpeciesabundance, organization1 *Organization) (*FSSpeciesabundance, error) { + setter := &FSSpeciesabundanceSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsSpeciesabundance0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSSpeciesabundanceOrganization0: %w", err) + } + + return fsSpeciesabundance0, nil +} + +func (fsSpeciesabundance0 *FSSpeciesabundance) 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 = attachFSSpeciesabundanceOrganization0(ctx, exec, 1, fsSpeciesabundance0, organization1) + if err != nil { + return err + } + + fsSpeciesabundance0.R.Organization = organization1 + + organization1.R.FSSpeciesabundances = append(organization1.R.FSSpeciesabundances, fsSpeciesabundance0) + + return nil +} + +func (fsSpeciesabundance0 *FSSpeciesabundance) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSSpeciesabundanceOrganization0(ctx, exec, 1, fsSpeciesabundance0, organization1) + if err != nil { + return err + } + + fsSpeciesabundance0.R.Organization = organization1 + + organization1.R.FSSpeciesabundances = append(organization1.R.FSSpeciesabundances, fsSpeciesabundance0) + + return nil +} + +type fsSpeciesabundanceWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Bloodedfem psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Eggs psql.WhereNullMod[Q, int16] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Females psql.WhereNullMod[Q, int64] + Gravidfem psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Larvae psql.WhereNullMod[Q, int16] + Males psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Poolstogen psql.WhereNullMod[Q, int16] + Processed psql.WhereNullMod[Q, int16] + Pupae psql.WhereNullMod[Q, int16] + Species psql.WhereNullMod[Q, string] + Total psql.WhereNullMod[Q, int64] + TrapdataID psql.WhereNullMod[Q, string] + Unknown psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Globalzscore psql.WhereNullMod[Q, float64] + H3R7 psql.WhereNullMod[Q, string] + H3R8 psql.WhereNullMod[Q, string] + R7score psql.WhereNullMod[Q, float64] + R8score psql.WhereNullMod[Q, float64] + Yearweek psql.WhereNullMod[Q, int64] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsSpeciesabundanceWhere[Q]) AliasedAs(alias string) fsSpeciesabundanceWhere[Q] { + return buildFSSpeciesabundanceWhere[Q](buildFSSpeciesabundanceColumns(alias)) +} + +func buildFSSpeciesabundanceWhere[Q psql.Filterable](cols fsSpeciesabundanceColumns) fsSpeciesabundanceWhere[Q] { + return fsSpeciesabundanceWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Eggs: psql.WhereNull[Q, int16](cols.Eggs), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Females: psql.WhereNull[Q, int64](cols.Females), + Gravidfem: psql.WhereNull[Q, int16](cols.Gravidfem), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Larvae: psql.WhereNull[Q, int16](cols.Larvae), + Males: psql.WhereNull[Q, int16](cols.Males), + Objectid: psql.Where[Q, int32](cols.Objectid), + Poolstogen: psql.WhereNull[Q, int16](cols.Poolstogen), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Pupae: psql.WhereNull[Q, int16](cols.Pupae), + Species: psql.WhereNull[Q, string](cols.Species), + Total: psql.WhereNull[Q, int64](cols.Total), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + Unknown: psql.WhereNull[Q, int16](cols.Unknown), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Globalzscore: psql.WhereNull[Q, float64](cols.Globalzscore), + H3R7: psql.WhereNull[Q, string](cols.H3R7), + H3R8: psql.WhereNull[Q, string](cols.H3R8), + R7score: psql.WhereNull[Q, float64](cols.R7score), + R8score: psql.WhereNull[Q, float64](cols.R8score), + Yearweek: psql.WhereNull[Q, int64](cols.Yearweek), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSSpeciesabundance) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsSpeciesabundance cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSSpeciesabundances = FSSpeciesabundanceSlice{o} + } + return nil + default: + return fmt.Errorf("fsSpeciesabundance has no relationship %q", name) + } +} + +type fsSpeciesabundancePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSSpeciesabundancePreloader() fsSpeciesabundancePreloader { + return fsSpeciesabundancePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSSpeciesabundances, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsSpeciesabundanceThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSSpeciesabundanceThenLoader[Q orm.Loadable]() fsSpeciesabundanceThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsSpeciesabundanceThenLoader[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 fsSpeciesabundance's Organization into the .R struct +func (o *FSSpeciesabundance) 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.FSSpeciesabundances = FSSpeciesabundanceSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsSpeciesabundance's Organization into the .R struct +func (os FSSpeciesabundanceSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSSpeciesabundances = append(rel.R.FSSpeciesabundances, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsSpeciesabundanceJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsSpeciesabundanceJoins[Q]) aliasedAs(alias string) fsSpeciesabundanceJoins[Q] { + return buildFSSpeciesabundanceJoins[Q](buildFSSpeciesabundanceColumns(alias), j.typ) +} + +func buildFSSpeciesabundanceJoins[Q dialect.Joinable](cols fsSpeciesabundanceColumns, typ string) fsSpeciesabundanceJoins[Q] { + return fsSpeciesabundanceJoins[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_stormdrain.bob.go b/models/fs_stormdrain.bob.go new file mode 100644 index 00000000..082a6935 --- /dev/null +++ b/models/fs_stormdrain.bob.go @@ -0,0 +1,1133 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSStormdrain is an object representing the database table. +type FSStormdrain 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" ` + Updated time.Time `db:"updated" ` + + R fsStormdrainR `db:"-" ` +} + +// FSStormdrainSlice is an alias for a slice of pointers to FSStormdrain. +// This should almost always be used instead of []*FSStormdrain. +type FSStormdrainSlice []*FSStormdrain + +// FSStormdrains contains methods to work with the fs_stormdrain table +var FSStormdrains = psql.NewTablex[*FSStormdrain, FSStormdrainSlice, *FSStormdrainSetter]("", "fs_stormdrain", buildFSStormdrainColumns("fs_stormdrain")) + +// FSStormdrainsQuery is a query on the fs_stormdrain table +type FSStormdrainsQuery = *psql.ViewQuery[*FSStormdrain, FSStormdrainSlice] + +// fsStormdrainR is where relationships are stored. +type fsStormdrainR struct { + Organization *Organization // fs_stormdrain.fs_stormdrain_organization_id_fkey +} + +func buildFSStormdrainColumns(alias string) fsStormdrainColumns { + return fsStormdrainColumns{ + 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", "updated", + ).WithParent("fs_stormdrain"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Lastaction: psql.Quote(alias, "lastaction"), + Laststatus: psql.Quote(alias, "laststatus"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Nexttreatmentdate: psql.Quote(alias, "nexttreatmentdate"), + Objectid: psql.Quote(alias, "objectid"), + Symbology: psql.Quote(alias, "symbology"), + Type: psql.Quote(alias, "type"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsStormdrainColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Jurisdiction psql.Expression + Lastaction psql.Expression + Laststatus psql.Expression + Lasttreatdate psql.Expression + Nexttreatmentdate psql.Expression + Objectid psql.Expression + Symbology psql.Expression + Type psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsStormdrainColumns) Alias() string { + return c.tableAlias +} + +func (fsStormdrainColumns) AliasedAs(alias string) fsStormdrainColumns { + return buildFSStormdrainColumns(alias) +} + +// FSStormdrainSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSStormdrainSetter) SetColumns() []string { + vals := make([]string, 0, 23) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Lastaction.IsUnset() { + vals = append(vals, "lastaction") + } + if !s.Laststatus.IsUnset() { + vals = append(vals, "laststatus") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Nexttreatmentdate.IsUnset() { + vals = append(vals, "nexttreatmentdate") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Type.IsUnset() { + vals = append(vals, "type") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSStormdrainSetter) Overwrite(t *FSStormdrain) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Lastaction.IsUnset() { + t.Lastaction = s.Lastaction.MustGetNull() + } + if !s.Laststatus.IsUnset() { + t.Laststatus = s.Laststatus.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Nexttreatmentdate.IsUnset() { + t.Nexttreatmentdate = s.Nexttreatmentdate.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Type.IsUnset() { + t.Type = s.Type.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSStormdrainSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSStormdrains.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, 23) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[6] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Lastaction.IsUnset() { + vals[7] = psql.Arg(s.Lastaction.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Laststatus.IsUnset() { + vals[8] = psql.Arg(s.Laststatus.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[9] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Nexttreatmentdate.IsUnset() { + vals[10] = psql.Arg(s.Nexttreatmentdate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[11] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[12] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Type.IsUnset() { + vals[13] = psql.Arg(s.Type.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[14] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[15] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[18] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[19] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[21] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[22] = psql.Arg(s.Updated.MustGet()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSStormdrainSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 23) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Lastaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastaction")...), + psql.Arg(s.Lastaction), + }}) + } + + if !s.Laststatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "laststatus")...), + psql.Arg(s.Laststatus), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Nexttreatmentdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nexttreatmentdate")...), + psql.Arg(s.Nexttreatmentdate), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Type.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type")...), + psql.Arg(s.Type), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSStormdrain retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSStormdrain(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSStormdrain, error) { + if len(cols) == 0 { + return FSStormdrains.Query( + sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSStormdrains.Query( + sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSStormdrains.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSStormdrainExists checks the presence of a single record by primary key +func FSStormdrainExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSStormdrains.Query( + sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSStormdrain is retrieved from the database +func (o *FSStormdrain) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSStormdrains.AfterSelectHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSStormdrains.AfterInsertHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSStormdrain +func (o *FSStormdrain) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSStormdrain) pkEQ() dialect.Expression { + return psql.Quote("fs_stormdrain", "objectid").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 FSStormdrain +func (o *FSStormdrain) Update(ctx context.Context, exec bob.Executor, s *FSStormdrainSetter) error { + v, err := FSStormdrains.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 FSStormdrain record with an executor +func (o *FSStormdrain) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSStormdrains.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSStormdrain using the executor +func (o *FSStormdrain) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSStormdrains.Query( + sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSStormdrainSlice is retrieved from the database +func (o FSStormdrainSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSStormdrains.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSStormdrains.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSStormdrainSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_stormdrain", "objectid").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 FSStormdrainSlice) copyMatchingRows(from ...*FSStormdrain) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSStormdrainSlice) 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 FSStormdrains.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 *FSStormdrain: + o.copyMatchingRows(retrieved) + case []*FSStormdrain: + o.copyMatchingRows(retrieved...) + case FSStormdrainSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSStormdrain or a slice of FSStormdrain + // then run the AfterUpdateHooks on the slice + _, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSStormdrainSlice) 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 FSStormdrains.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 *FSStormdrain: + o.copyMatchingRows(retrieved) + case []*FSStormdrain: + o.copyMatchingRows(retrieved...) + case FSStormdrainSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSStormdrain or a slice of FSStormdrain + // then run the AfterDeleteHooks on the slice + _, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSStormdrainSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSStormdrainSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSStormdrains.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSStormdrainSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSStormdrains.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSStormdrainSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSStormdrains.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 *FSStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, fsStormdrain0 *FSStormdrain, organization1 *Organization) (*FSStormdrain, error) { + setter := &FSStormdrainSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsStormdrain0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSStormdrainOrganization0: %w", err) + } + + return fsStormdrain0, nil +} + +func (fsStormdrain0 *FSStormdrain) 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 = attachFSStormdrainOrganization0(ctx, exec, 1, fsStormdrain0, organization1) + if err != nil { + return err + } + + fsStormdrain0.R.Organization = organization1 + + organization1.R.FSStormdrains = append(organization1.R.FSStormdrains, fsStormdrain0) + + return nil +} + +func (fsStormdrain0 *FSStormdrain) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSStormdrainOrganization0(ctx, exec, 1, fsStormdrain0, organization1) + if err != nil { + return err + } + + fsStormdrain0.R.Organization = organization1 + + organization1.R.FSStormdrains = append(organization1.R.FSStormdrains, fsStormdrain0) + + return nil +} + +type fsStormdrainWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Lastaction psql.WhereNullMod[Q, string] + Laststatus psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Nexttreatmentdate psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Symbology psql.WhereNullMod[Q, string] + Type psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsStormdrainWhere[Q]) AliasedAs(alias string) fsStormdrainWhere[Q] { + return buildFSStormdrainWhere[Q](buildFSStormdrainColumns(alias)) +} + +func buildFSStormdrainWhere[Q psql.Filterable](cols fsStormdrainColumns) fsStormdrainWhere[Q] { + return fsStormdrainWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Lastaction: psql.WhereNull[Q, string](cols.Lastaction), + Laststatus: psql.WhereNull[Q, string](cols.Laststatus), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Nexttreatmentdate: psql.WhereNull[Q, int64](cols.Nexttreatmentdate), + Objectid: psql.Where[Q, int32](cols.Objectid), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Type: psql.WhereNull[Q, string](cols.Type), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSStormdrain) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsStormdrain cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSStormdrains = FSStormdrainSlice{o} + } + return nil + default: + return fmt.Errorf("fsStormdrain has no relationship %q", name) + } +} + +type fsStormdrainPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSStormdrainPreloader() fsStormdrainPreloader { + return fsStormdrainPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSStormdrains, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsStormdrainThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSStormdrainThenLoader[Q orm.Loadable]() fsStormdrainThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsStormdrainThenLoader[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 fsStormdrain's Organization into the .R struct +func (o *FSStormdrain) 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.FSStormdrains = FSStormdrainSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsStormdrain's Organization into the .R struct +func (os FSStormdrainSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSStormdrains = append(rel.R.FSStormdrains, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsStormdrainJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsStormdrainJoins[Q]) aliasedAs(alias string) fsStormdrainJoins[Q] { + return buildFSStormdrainJoins[Q](buildFSStormdrainColumns(alias), j.typ) +} + +func buildFSStormdrainJoins[Q dialect.Joinable](cols fsStormdrainColumns, typ string) fsStormdrainJoins[Q] { + return fsStormdrainJoins[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_timecard.bob.go b/models/fs_timecard.bob.go new file mode 100644 index 00000000..a0194144 --- /dev/null +++ b/models/fs_timecard.bob.go @@ -0,0 +1,1358 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSTimecard is an object representing the database table. +type FSTimecard 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" ` + Updated time.Time `db:"updated" ` + + R fsTimecardR `db:"-" ` +} + +// FSTimecardSlice is an alias for a slice of pointers to FSTimecard. +// This should almost always be used instead of []*FSTimecard. +type FSTimecardSlice []*FSTimecard + +// FSTimecards contains methods to work with the fs_timecard table +var FSTimecards = psql.NewTablex[*FSTimecard, FSTimecardSlice, *FSTimecardSetter]("", "fs_timecard", buildFSTimecardColumns("fs_timecard")) + +// FSTimecardsQuery is a query on the fs_timecard table +type FSTimecardsQuery = *psql.ViewQuery[*FSTimecard, FSTimecardSlice] + +// fsTimecardR is where relationships are stored. +type fsTimecardR struct { + Organization *Organization // fs_timecard.fs_timecard_organization_id_fkey +} + +func buildFSTimecardColumns(alias string) fsTimecardColumns { + return fsTimecardColumns{ + 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", "updated", + ).WithParent("fs_timecard"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Equiptype: psql.Quote(alias, "equiptype"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Lclocid: psql.Quote(alias, "lclocid"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Samplelocid: psql.Quote(alias, "samplelocid"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Traplocid: psql.Quote(alias, "traplocid"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Rodentlocid: psql.Quote(alias, "rodentlocid"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsTimecardColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Equiptype psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Lclocid psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Samplelocid psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Traplocid psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Rodentlocid psql.Expression + Updated psql.Expression +} + +func (c fsTimecardColumns) Alias() string { + return c.tableAlias +} + +func (fsTimecardColumns) AliasedAs(alias string) fsTimecardColumns { + return buildFSTimecardColumns(alias) +} + +// FSTimecardSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSTimecardSetter) SetColumns() []string { + vals := make([]string, 0, 32) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Equiptype.IsUnset() { + vals = append(vals, "equiptype") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lclocid.IsUnset() { + vals = append(vals, "lclocid") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Samplelocid.IsUnset() { + vals = append(vals, "samplelocid") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Traplocid.IsUnset() { + vals = append(vals, "traplocid") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Rodentlocid.IsUnset() { + vals = append(vals, "rodentlocid") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSTimecardSetter) Overwrite(t *FSTimecard) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Equiptype.IsUnset() { + t.Equiptype = s.Equiptype.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lclocid.IsUnset() { + t.Lclocid = s.Lclocid.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Samplelocid.IsUnset() { + t.Samplelocid = s.Samplelocid.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Traplocid.IsUnset() { + t.Traplocid = s.Traplocid.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Rodentlocid.IsUnset() { + t.Rodentlocid = s.Rodentlocid.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSTimecardSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSTimecards.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, 32) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[3] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[4] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Equiptype.IsUnset() { + vals[6] = psql.Arg(s.Equiptype.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[10] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lclocid.IsUnset() { + vals[12] = psql.Arg(s.Lclocid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[13] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[14] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[15] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[16] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[17] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Samplelocid.IsUnset() { + vals[18] = psql.Arg(s.Samplelocid.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[19] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[20] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Traplocid.IsUnset() { + vals[21] = psql.Arg(s.Traplocid.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[22] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[23] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[24] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[25] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[26] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[27] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[28] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[29] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Rodentlocid.IsUnset() { + vals[30] = psql.Arg(s.Rodentlocid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[31] = psql.Arg(s.Updated.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSTimecardSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 32) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Equiptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "equiptype")...), + psql.Arg(s.Equiptype), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lclocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lclocid")...), + psql.Arg(s.Lclocid), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Samplelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplelocid")...), + psql.Arg(s.Samplelocid), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Traplocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "traplocid")...), + psql.Arg(s.Traplocid), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Rodentlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rodentlocid")...), + psql.Arg(s.Rodentlocid), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSTimecard retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSTimecard(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTimecard, error) { + if len(cols) == 0 { + return FSTimecards.Query( + sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSTimecards.Query( + sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSTimecards.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSTimecardExists checks the presence of a single record by primary key +func FSTimecardExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSTimecards.Query( + sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSTimecard is retrieved from the database +func (o *FSTimecard) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTimecards.AfterSelectHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSTimecards.AfterInsertHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSTimecard +func (o *FSTimecard) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSTimecard) pkEQ() dialect.Expression { + return psql.Quote("fs_timecard", "objectid").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 FSTimecard +func (o *FSTimecard) Update(ctx context.Context, exec bob.Executor, s *FSTimecardSetter) error { + v, err := FSTimecards.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 FSTimecard record with an executor +func (o *FSTimecard) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSTimecards.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSTimecard using the executor +func (o *FSTimecard) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSTimecards.Query( + sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSTimecardSlice is retrieved from the database +func (o FSTimecardSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTimecards.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSTimecards.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSTimecardSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_timecard", "objectid").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 FSTimecardSlice) copyMatchingRows(from ...*FSTimecard) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSTimecardSlice) 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 FSTimecards.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 *FSTimecard: + o.copyMatchingRows(retrieved) + case []*FSTimecard: + o.copyMatchingRows(retrieved...) + case FSTimecardSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTimecard or a slice of FSTimecard + // then run the AfterUpdateHooks on the slice + _, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSTimecardSlice) 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 FSTimecards.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 *FSTimecard: + o.copyMatchingRows(retrieved) + case []*FSTimecard: + o.copyMatchingRows(retrieved...) + case FSTimecardSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTimecard or a slice of FSTimecard + // then run the AfterDeleteHooks on the slice + _, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSTimecardSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTimecardSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSTimecards.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSTimecardSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSTimecards.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSTimecardSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSTimecards.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 *FSTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, fsTimecard0 *FSTimecard, organization1 *Organization) (*FSTimecard, error) { + setter := &FSTimecardSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsTimecard0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSTimecardOrganization0: %w", err) + } + + return fsTimecard0, nil +} + +func (fsTimecard0 *FSTimecard) 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 = attachFSTimecardOrganization0(ctx, exec, 1, fsTimecard0, organization1) + if err != nil { + return err + } + + fsTimecard0.R.Organization = organization1 + + organization1.R.FSTimecards = append(organization1.R.FSTimecards, fsTimecard0) + + return nil +} + +func (fsTimecard0 *FSTimecard) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSTimecardOrganization0(ctx, exec, 1, fsTimecard0, organization1) + if err != nil { + return err + } + + fsTimecard0.R.Organization = organization1 + + organization1.R.FSTimecards = append(organization1.R.FSTimecards, fsTimecard0) + + return nil +} + +type fsTimecardWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Equiptype psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Lclocid psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Samplelocid psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Traplocid psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Rodentlocid psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsTimecardWhere[Q]) AliasedAs(alias string) fsTimecardWhere[Q] { + return buildFSTimecardWhere[Q](buildFSTimecardColumns(alias)) +} + +func buildFSTimecardWhere[Q psql.Filterable](cols fsTimecardColumns) fsTimecardWhere[Q] { + return fsTimecardWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lclocid: psql.WhereNull[Q, string](cols.Lclocid), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Samplelocid: psql.WhereNull[Q, string](cols.Samplelocid), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Traplocid: psql.WhereNull[Q, string](cols.Traplocid), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Rodentlocid: psql.WhereNull[Q, string](cols.Rodentlocid), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSTimecard) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsTimecard cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSTimecards = FSTimecardSlice{o} + } + return nil + default: + return fmt.Errorf("fsTimecard has no relationship %q", name) + } +} + +type fsTimecardPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSTimecardPreloader() fsTimecardPreloader { + return fsTimecardPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSTimecards, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsTimecardThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSTimecardThenLoader[Q orm.Loadable]() fsTimecardThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsTimecardThenLoader[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 fsTimecard's Organization into the .R struct +func (o *FSTimecard) 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.FSTimecards = FSTimecardSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsTimecard's Organization into the .R struct +func (os FSTimecardSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSTimecards = append(rel.R.FSTimecards, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsTimecardJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsTimecardJoins[Q]) aliasedAs(alias string) fsTimecardJoins[Q] { + return buildFSTimecardJoins[Q](buildFSTimecardColumns(alias), j.typ) +} + +func buildFSTimecardJoins[Q dialect.Joinable](cols fsTimecardColumns, typ string) fsTimecardJoins[Q] { + return fsTimecardJoins[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_trapdata.bob.go b/models/fs_trapdata.bob.go new file mode 100644 index 00000000..e897ec44 --- /dev/null +++ b/models/fs_trapdata.bob.go @@ -0,0 +1,1708 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSTrapdatum is an object representing the database table. +type FSTrapdatum 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" ` + Updated time.Time `db:"updated" ` + + R fsTrapdatumR `db:"-" ` +} + +// FSTrapdatumSlice is an alias for a slice of pointers to FSTrapdatum. +// This should almost always be used instead of []*FSTrapdatum. +type FSTrapdatumSlice []*FSTrapdatum + +// FSTrapdata contains methods to work with the fs_trapdata table +var FSTrapdata = psql.NewTablex[*FSTrapdatum, FSTrapdatumSlice, *FSTrapdatumSetter]("", "fs_trapdata", buildFSTrapdatumColumns("fs_trapdata")) + +// FSTrapdataQuery is a query on the fs_trapdata table +type FSTrapdataQuery = *psql.ViewQuery[*FSTrapdatum, FSTrapdatumSlice] + +// fsTrapdatumR is where relationships are stored. +type fsTrapdatumR struct { + Organization *Organization // fs_trapdata.fs_trapdata_organization_id_fkey +} + +func buildFSTrapdatumColumns(alias string) fsTrapdatumColumns { + return fsTrapdatumColumns{ + 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", "updated", + ).WithParent("fs_trapdata"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Avetemp: psql.Quote(alias, "avetemp"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Field: psql.Quote(alias, "field"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Idbytech: psql.Quote(alias, "idbytech"), + Locationname: psql.Quote(alias, "locationname"), + LocID: psql.Quote(alias, "loc_id"), + LR: psql.Quote(alias, "lr"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sitecond: psql.Quote(alias, "sitecond"), + Sortbytech: psql.Quote(alias, "sortbytech"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Trapactivitytype: psql.Quote(alias, "trapactivitytype"), + Trapcondition: psql.Quote(alias, "trapcondition"), + Trapnights: psql.Quote(alias, "trapnights"), + Traptype: psql.Quote(alias, "traptype"), + Voltage: psql.Quote(alias, "voltage"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Lure: psql.Quote(alias, "lure"), + Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), + Vectorsurvtraplocationid: psql.Quote(alias, "vectorsurvtraplocationid"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsTrapdatumColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Avetemp psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Field psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Idbytech psql.Expression + Locationname psql.Expression + LocID psql.Expression + LR psql.Expression + Objectid psql.Expression + Processed psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sitecond psql.Expression + Sortbytech psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Trapactivitytype psql.Expression + Trapcondition psql.Expression + Trapnights psql.Expression + Traptype psql.Expression + Voltage psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Lure psql.Expression + Vectorsurvtrapdataid psql.Expression + Vectorsurvtraplocationid psql.Expression + Updated psql.Expression +} + +func (c fsTrapdatumColumns) Alias() string { + return c.tableAlias +} + +func (fsTrapdatumColumns) AliasedAs(alias string) fsTrapdatumColumns { + return buildFSTrapdatumColumns(alias) +} + +// FSTrapdatumSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSTrapdatumSetter) SetColumns() []string { + vals := make([]string, 0, 46) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Field.IsUnset() { + vals = append(vals, "field") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Idbytech.IsUnset() { + vals = append(vals, "idbytech") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LocID.IsUnset() { + vals = append(vals, "loc_id") + } + if !s.LR.IsUnset() { + vals = append(vals, "lr") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Sortbytech.IsUnset() { + vals = append(vals, "sortbytech") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Trapactivitytype.IsUnset() { + vals = append(vals, "trapactivitytype") + } + if !s.Trapcondition.IsUnset() { + vals = append(vals, "trapcondition") + } + if !s.Trapnights.IsUnset() { + vals = append(vals, "trapnights") + } + if !s.Traptype.IsUnset() { + vals = append(vals, "traptype") + } + if !s.Voltage.IsUnset() { + vals = append(vals, "voltage") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Lure.IsUnset() { + vals = append(vals, "lure") + } + if !s.Vectorsurvtrapdataid.IsUnset() { + vals = append(vals, "vectorsurvtrapdataid") + } + if !s.Vectorsurvtraplocationid.IsUnset() { + vals = append(vals, "vectorsurvtraplocationid") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSTrapdatumSetter) Overwrite(t *FSTrapdatum) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Field.IsUnset() { + t.Field = s.Field.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Idbytech.IsUnset() { + t.Idbytech = s.Idbytech.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LocID.IsUnset() { + t.LocID = s.LocID.MustGetNull() + } + if !s.LR.IsUnset() { + t.LR = s.LR.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Sortbytech.IsUnset() { + t.Sortbytech = s.Sortbytech.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Trapactivitytype.IsUnset() { + t.Trapactivitytype = s.Trapactivitytype.MustGetNull() + } + if !s.Trapcondition.IsUnset() { + t.Trapcondition = s.Trapcondition.MustGetNull() + } + if !s.Trapnights.IsUnset() { + t.Trapnights = s.Trapnights.MustGetNull() + } + if !s.Traptype.IsUnset() { + t.Traptype = s.Traptype.MustGetNull() + } + if !s.Voltage.IsUnset() { + t.Voltage = s.Voltage.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Lure.IsUnset() { + t.Lure = s.Lure.MustGetNull() + } + if !s.Vectorsurvtrapdataid.IsUnset() { + t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() + } + if !s.Vectorsurvtraplocationid.IsUnset() { + t.Vectorsurvtraplocationid = s.Vectorsurvtraplocationid.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSTrapdatumSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSTrapdata.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, 46) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[1] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[3] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[4] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[6] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[7] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[8] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Field.IsUnset() { + vals[9] = psql.Arg(s.Field.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Idbytech.IsUnset() { + vals[12] = psql.Arg(s.Idbytech.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[13] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LocID.IsUnset() { + vals[14] = psql.Arg(s.LocID.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LR.IsUnset() { + vals[15] = psql.Arg(s.LR.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[17] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[18] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[19] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[20] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[21] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[22] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[23] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Sortbytech.IsUnset() { + vals[24] = psql.Arg(s.Sortbytech.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[25] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[26] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Trapactivitytype.IsUnset() { + vals[27] = psql.Arg(s.Trapactivitytype.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Trapcondition.IsUnset() { + vals[28] = psql.Arg(s.Trapcondition.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Trapnights.IsUnset() { + vals[29] = psql.Arg(s.Trapnights.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Traptype.IsUnset() { + vals[30] = psql.Arg(s.Traptype.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Voltage.IsUnset() { + vals[31] = psql.Arg(s.Voltage.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[32] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[33] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[34] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[35] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[36] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[37] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[38] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[39] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[40] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[41] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Lure.IsUnset() { + vals[42] = psql.Arg(s.Lure.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[43] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtraplocationid.IsUnset() { + vals[44] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[45] = psql.Arg(s.Updated.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 46) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Field.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "field")...), + psql.Arg(s.Field), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Idbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "idbytech")...), + psql.Arg(s.Idbytech), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LocID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "loc_id")...), + psql.Arg(s.LocID), + }}) + } + + if !s.LR.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lr")...), + psql.Arg(s.LR), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Sortbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sortbytech")...), + psql.Arg(s.Sortbytech), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Trapactivitytype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapactivitytype")...), + psql.Arg(s.Trapactivitytype), + }}) + } + + if !s.Trapcondition.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapcondition")...), + psql.Arg(s.Trapcondition), + }}) + } + + if !s.Trapnights.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapnights")...), + psql.Arg(s.Trapnights), + }}) + } + + if !s.Traptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "traptype")...), + psql.Arg(s.Traptype), + }}) + } + + if !s.Voltage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "voltage")...), + psql.Arg(s.Voltage), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Lure.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lure")...), + psql.Arg(s.Lure), + }}) + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtrapdataid")...), + psql.Arg(s.Vectorsurvtrapdataid), + }}) + } + + if !s.Vectorsurvtraplocationid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtraplocationid")...), + psql.Arg(s.Vectorsurvtraplocationid), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSTrapdatum retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSTrapdatum(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTrapdatum, error) { + if len(cols) == 0 { + return FSTrapdata.Query( + sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSTrapdata.Query( + sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSTrapdata.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSTrapdatumExists checks the presence of a single record by primary key +func FSTrapdatumExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSTrapdata.Query( + sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSTrapdatum is retrieved from the database +func (o *FSTrapdatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTrapdata.AfterSelectHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSTrapdata.AfterInsertHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSTrapdatum +func (o *FSTrapdatum) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSTrapdatum) pkEQ() dialect.Expression { + return psql.Quote("fs_trapdata", "objectid").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 FSTrapdatum +func (o *FSTrapdatum) Update(ctx context.Context, exec bob.Executor, s *FSTrapdatumSetter) error { + v, err := FSTrapdata.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 FSTrapdatum record with an executor +func (o *FSTrapdatum) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSTrapdata.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSTrapdatum using the executor +func (o *FSTrapdatum) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSTrapdata.Query( + sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSTrapdatumSlice is retrieved from the database +func (o FSTrapdatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTrapdata.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSTrapdata.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSTrapdatumSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_trapdata", "objectid").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 FSTrapdatumSlice) copyMatchingRows(from ...*FSTrapdatum) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSTrapdatumSlice) 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 FSTrapdata.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 *FSTrapdatum: + o.copyMatchingRows(retrieved) + case []*FSTrapdatum: + o.copyMatchingRows(retrieved...) + case FSTrapdatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTrapdatum or a slice of FSTrapdatum + // then run the AfterUpdateHooks on the slice + _, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSTrapdatumSlice) 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 FSTrapdata.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 *FSTrapdatum: + o.copyMatchingRows(retrieved) + case []*FSTrapdatum: + o.copyMatchingRows(retrieved...) + case FSTrapdatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTrapdatum or a slice of FSTrapdatum + // then run the AfterDeleteHooks on the slice + _, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSTrapdatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTrapdatumSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSTrapdata.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSTrapdatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSTrapdata.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSTrapdatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSTrapdata.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 *FSTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, fsTrapdatum0 *FSTrapdatum, organization1 *Organization) (*FSTrapdatum, error) { + setter := &FSTrapdatumSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsTrapdatum0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSTrapdatumOrganization0: %w", err) + } + + return fsTrapdatum0, nil +} + +func (fsTrapdatum0 *FSTrapdatum) 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 = attachFSTrapdatumOrganization0(ctx, exec, 1, fsTrapdatum0, organization1) + if err != nil { + return err + } + + fsTrapdatum0.R.Organization = organization1 + + organization1.R.FSTrapdata = append(organization1.R.FSTrapdata, fsTrapdatum0) + + return nil +} + +func (fsTrapdatum0 *FSTrapdatum) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSTrapdatumOrganization0(ctx, exec, 1, fsTrapdatum0, organization1) + if err != nil { + return err + } + + fsTrapdatum0.R.Organization = organization1 + + organization1.R.FSTrapdata = append(organization1.R.FSTrapdata, fsTrapdatum0) + + return nil +} + +type fsTrapdatumWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Avetemp psql.WhereNullMod[Q, float64] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Field psql.WhereNullMod[Q, int64] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Idbytech psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LocID psql.WhereNullMod[Q, string] + LR psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sitecond psql.WhereNullMod[Q, string] + Sortbytech psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Trapactivitytype psql.WhereNullMod[Q, string] + Trapcondition psql.WhereNullMod[Q, string] + Trapnights psql.WhereNullMod[Q, int16] + Traptype psql.WhereNullMod[Q, string] + Voltage psql.WhereNullMod[Q, float64] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Lure psql.WhereNullMod[Q, string] + Vectorsurvtrapdataid psql.WhereNullMod[Q, string] + Vectorsurvtraplocationid psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsTrapdatumWhere[Q]) AliasedAs(alias string) fsTrapdatumWhere[Q] { + return buildFSTrapdatumWhere[Q](buildFSTrapdatumColumns(alias)) +} + +func buildFSTrapdatumWhere[Q psql.Filterable](cols fsTrapdatumColumns) fsTrapdatumWhere[Q] { + return fsTrapdatumWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Field: psql.WhereNull[Q, int64](cols.Field), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Idbytech: psql.WhereNull[Q, string](cols.Idbytech), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LocID: psql.WhereNull[Q, string](cols.LocID), + LR: psql.WhereNull[Q, int16](cols.LR), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Sortbytech: psql.WhereNull[Q, string](cols.Sortbytech), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Trapactivitytype: psql.WhereNull[Q, string](cols.Trapactivitytype), + Trapcondition: psql.WhereNull[Q, string](cols.Trapcondition), + Trapnights: psql.WhereNull[Q, int16](cols.Trapnights), + Traptype: psql.WhereNull[Q, string](cols.Traptype), + Voltage: psql.WhereNull[Q, float64](cols.Voltage), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Lure: psql.WhereNull[Q, string](cols.Lure), + Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), + Vectorsurvtraplocationid: psql.WhereNull[Q, string](cols.Vectorsurvtraplocationid), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSTrapdatum) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsTrapdatum cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSTrapdata = FSTrapdatumSlice{o} + } + return nil + default: + return fmt.Errorf("fsTrapdatum has no relationship %q", name) + } +} + +type fsTrapdatumPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSTrapdatumPreloader() fsTrapdatumPreloader { + return fsTrapdatumPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSTrapdata, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsTrapdatumThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSTrapdatumThenLoader[Q orm.Loadable]() fsTrapdatumThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsTrapdatumThenLoader[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 fsTrapdatum's Organization into the .R struct +func (o *FSTrapdatum) 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.FSTrapdata = FSTrapdatumSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsTrapdatum's Organization into the .R struct +func (os FSTrapdatumSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSTrapdata = append(rel.R.FSTrapdata, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsTrapdatumJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsTrapdatumJoins[Q]) aliasedAs(alias string) fsTrapdatumJoins[Q] { + return buildFSTrapdatumJoins[Q](buildFSTrapdatumColumns(alias), j.typ) +} + +func buildFSTrapdatumJoins[Q dialect.Joinable](cols fsTrapdatumColumns, typ string) fsTrapdatumJoins[Q] { + return fsTrapdatumJoins[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_traplocation.bob.go b/models/fs_traplocation.bob.go new file mode 100644 index 00000000..78c09c7f --- /dev/null +++ b/models/fs_traplocation.bob.go @@ -0,0 +1,1408 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSTraplocation is an object representing the database table. +type FSTraplocation 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" ` + Updated time.Time `db:"updated" ` + + R fsTraplocationR `db:"-" ` +} + +// FSTraplocationSlice is an alias for a slice of pointers to FSTraplocation. +// This should almost always be used instead of []*FSTraplocation. +type FSTraplocationSlice []*FSTraplocation + +// FSTraplocations contains methods to work with the fs_traplocation table +var FSTraplocations = psql.NewTablex[*FSTraplocation, FSTraplocationSlice, *FSTraplocationSetter]("", "fs_traplocation", buildFSTraplocationColumns("fs_traplocation")) + +// FSTraplocationsQuery is a query on the fs_traplocation table +type FSTraplocationsQuery = *psql.ViewQuery[*FSTraplocation, FSTraplocationSlice] + +// fsTraplocationR is where relationships are stored. +type fsTraplocationR struct { + Organization *Organization // fs_traplocation.fs_traplocation_organization_id_fkey +} + +func buildFSTraplocationColumns(alias string) fsTraplocationColumns { + return fsTraplocationColumns{ + 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", "updated", + ).WithParent("fs_traplocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Route: psql.Quote(alias, "route"), + RouteOrder: psql.Quote(alias, "route_order"), + SetDow: psql.Quote(alias, "set_dow"), + Vectorsurvsiteid: psql.Quote(alias, "vectorsurvsiteid"), + H3R7: psql.Quote(alias, "h3r7"), + H3R8: psql.Quote(alias, "h3r8"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsTraplocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Route psql.Expression + RouteOrder psql.Expression + SetDow psql.Expression + Vectorsurvsiteid psql.Expression + H3R7 psql.Expression + H3R8 psql.Expression + Updated psql.Expression +} + +func (c fsTraplocationColumns) Alias() string { + return c.tableAlias +} + +func (fsTraplocationColumns) AliasedAs(alias string) fsTraplocationColumns { + return buildFSTraplocationColumns(alias) +} + +// FSTraplocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSTraplocationSetter) SetColumns() []string { + vals := make([]string, 0, 34) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Route.IsUnset() { + vals = append(vals, "route") + } + if !s.RouteOrder.IsUnset() { + vals = append(vals, "route_order") + } + if !s.SetDow.IsUnset() { + vals = append(vals, "set_dow") + } + if !s.Vectorsurvsiteid.IsUnset() { + vals = append(vals, "vectorsurvsiteid") + } + if !s.H3R7.IsUnset() { + vals = append(vals, "h3r7") + } + if !s.H3R8.IsUnset() { + vals = append(vals, "h3r8") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSTraplocationSetter) Overwrite(t *FSTraplocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Route.IsUnset() { + t.Route = s.Route.MustGetNull() + } + if !s.RouteOrder.IsUnset() { + t.RouteOrder = s.RouteOrder.MustGetNull() + } + if !s.SetDow.IsUnset() { + t.SetDow = s.SetDow.MustGetNull() + } + if !s.Vectorsurvsiteid.IsUnset() { + t.Vectorsurvsiteid = s.Vectorsurvsiteid.MustGetNull() + } + if !s.H3R7.IsUnset() { + t.H3R7 = s.H3R7.MustGetNull() + } + if !s.H3R8.IsUnset() { + t.H3R8 = s.H3R8.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSTraplocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSTraplocations.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, 34) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[14] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[17] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[18] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[19] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[20] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Route.IsUnset() { + vals[27] = psql.Arg(s.Route.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.RouteOrder.IsUnset() { + vals[28] = psql.Arg(s.RouteOrder.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.SetDow.IsUnset() { + vals[29] = psql.Arg(s.SetDow.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvsiteid.IsUnset() { + vals[30] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.H3R7.IsUnset() { + vals[31] = psql.Arg(s.H3R7.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.H3R8.IsUnset() { + vals[32] = psql.Arg(s.H3R8.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[33] = psql.Arg(s.Updated.MustGet()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSTraplocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 34) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Route.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "route")...), + psql.Arg(s.Route), + }}) + } + + if !s.RouteOrder.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "route_order")...), + psql.Arg(s.RouteOrder), + }}) + } + + if !s.SetDow.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "set_dow")...), + psql.Arg(s.SetDow), + }}) + } + + if !s.Vectorsurvsiteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvsiteid")...), + psql.Arg(s.Vectorsurvsiteid), + }}) + } + + if !s.H3R7.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r7")...), + psql.Arg(s.H3R7), + }}) + } + + if !s.H3R8.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r8")...), + psql.Arg(s.H3R8), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSTraplocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSTraplocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTraplocation, error) { + if len(cols) == 0 { + return FSTraplocations.Query( + sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSTraplocations.Query( + sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSTraplocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSTraplocationExists checks the presence of a single record by primary key +func FSTraplocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSTraplocations.Query( + sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSTraplocation is retrieved from the database +func (o *FSTraplocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTraplocations.AfterSelectHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSTraplocations.AfterInsertHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSTraplocation +func (o *FSTraplocation) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSTraplocation) pkEQ() dialect.Expression { + return psql.Quote("fs_traplocation", "objectid").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 FSTraplocation +func (o *FSTraplocation) Update(ctx context.Context, exec bob.Executor, s *FSTraplocationSetter) error { + v, err := FSTraplocations.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 FSTraplocation record with an executor +func (o *FSTraplocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSTraplocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSTraplocation using the executor +func (o *FSTraplocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSTraplocations.Query( + sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSTraplocationSlice is retrieved from the database +func (o FSTraplocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTraplocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSTraplocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSTraplocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_traplocation", "objectid").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 FSTraplocationSlice) copyMatchingRows(from ...*FSTraplocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSTraplocationSlice) 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 FSTraplocations.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 *FSTraplocation: + o.copyMatchingRows(retrieved) + case []*FSTraplocation: + o.copyMatchingRows(retrieved...) + case FSTraplocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTraplocation or a slice of FSTraplocation + // then run the AfterUpdateHooks on the slice + _, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSTraplocationSlice) 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 FSTraplocations.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 *FSTraplocation: + o.copyMatchingRows(retrieved) + case []*FSTraplocation: + o.copyMatchingRows(retrieved...) + case FSTraplocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTraplocation or a slice of FSTraplocation + // then run the AfterDeleteHooks on the slice + _, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSTraplocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTraplocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSTraplocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSTraplocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSTraplocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSTraplocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSTraplocations.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 *FSTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsTraplocation0 *FSTraplocation, organization1 *Organization) (*FSTraplocation, error) { + setter := &FSTraplocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsTraplocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSTraplocationOrganization0: %w", err) + } + + return fsTraplocation0, nil +} + +func (fsTraplocation0 *FSTraplocation) 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 = attachFSTraplocationOrganization0(ctx, exec, 1, fsTraplocation0, organization1) + if err != nil { + return err + } + + fsTraplocation0.R.Organization = organization1 + + organization1.R.FSTraplocations = append(organization1.R.FSTraplocations, fsTraplocation0) + + return nil +} + +func (fsTraplocation0 *FSTraplocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSTraplocationOrganization0(ctx, exec, 1, fsTraplocation0, organization1) + if err != nil { + return err + } + + fsTraplocation0.R.Organization = organization1 + + organization1.R.FSTraplocations = append(organization1.R.FSTraplocations, fsTraplocation0) + + return nil +} + +type fsTraplocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Route psql.WhereNullMod[Q, int64] + RouteOrder psql.WhereNullMod[Q, int64] + SetDow psql.WhereNullMod[Q, int64] + Vectorsurvsiteid psql.WhereNullMod[Q, string] + H3R7 psql.WhereNullMod[Q, string] + H3R8 psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsTraplocationWhere[Q]) AliasedAs(alias string) fsTraplocationWhere[Q] { + return buildFSTraplocationWhere[Q](buildFSTraplocationColumns(alias)) +} + +func buildFSTraplocationWhere[Q psql.Filterable](cols fsTraplocationColumns) fsTraplocationWhere[Q] { + return fsTraplocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Route: psql.WhereNull[Q, int64](cols.Route), + RouteOrder: psql.WhereNull[Q, int64](cols.RouteOrder), + SetDow: psql.WhereNull[Q, int64](cols.SetDow), + Vectorsurvsiteid: psql.WhereNull[Q, string](cols.Vectorsurvsiteid), + H3R7: psql.WhereNull[Q, string](cols.H3R7), + H3R8: psql.WhereNull[Q, string](cols.H3R8), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSTraplocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsTraplocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSTraplocations = FSTraplocationSlice{o} + } + return nil + default: + return fmt.Errorf("fsTraplocation has no relationship %q", name) + } +} + +type fsTraplocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSTraplocationPreloader() fsTraplocationPreloader { + return fsTraplocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSTraplocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsTraplocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSTraplocationThenLoader[Q orm.Loadable]() fsTraplocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsTraplocationThenLoader[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 fsTraplocation's Organization into the .R struct +func (o *FSTraplocation) 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.FSTraplocations = FSTraplocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsTraplocation's Organization into the .R struct +func (os FSTraplocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSTraplocations = append(rel.R.FSTraplocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsTraplocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsTraplocationJoins[Q]) aliasedAs(alias string) fsTraplocationJoins[Q] { + return buildFSTraplocationJoins[Q](buildFSTraplocationColumns(alias), j.typ) +} + +func buildFSTraplocationJoins[Q dialect.Joinable](cols fsTraplocationColumns, typ string) fsTraplocationJoins[Q] { + return fsTraplocationJoins[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_treatment.bob.go b/models/fs_treatment.bob.go new file mode 100644 index 00000000..fffce7e4 --- /dev/null +++ b/models/fs_treatment.bob.go @@ -0,0 +1,2008 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSTreatment is an object representing the database table. +type FSTreatment struct { + OrganizationID null.Val[int32] `db:"organization_id" ` + Activity null.Val[string] `db:"activity" ` + Areaunit null.Val[string] `db:"areaunit" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Barrierrouteid null.Val[string] `db:"barrierrouteid" ` + 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" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Equiptype null.Val[string] `db:"equiptype" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Flowrate null.Val[float64] `db:"flowrate" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + InspID null.Val[string] `db:"insp_id" ` + Invloc null.Val[string] `db:"invloc" ` + Linelocid null.Val[string] `db:"linelocid" ` + Locationname null.Val[string] `db:"locationname" ` + Method null.Val[string] `db:"method" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Polygonlocid null.Val[string] `db:"polygonlocid" ` + Product null.Val[string] `db:"product" ` + Ptaid null.Val[string] `db:"ptaid" ` + Qty null.Val[float64] `db:"qty" ` + Qtyunit null.Val[string] `db:"qtyunit" ` + 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" ` + Targetspecies null.Val[string] `db:"targetspecies" ` + Tirecount null.Val[int16] `db:"tirecount" ` + Treatacres null.Val[float64] `db:"treatacres" ` + Treatarea null.Val[float64] `db:"treatarea" ` + Treathectares null.Val[float64] `db:"treathectares" ` + Treatmenthours null.Val[float64] `db:"treatmenthours" ` + Treatmentlength null.Val[float64] `db:"treatmentlength" ` + Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` + Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` + Ulvrouteid null.Val[string] `db:"ulvrouteid" ` + Warningoverride null.Val[int16] `db:"warningoverride" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + TempSitecond null.Val[string] `db:"temp_sitecond" ` + Updated time.Time `db:"updated" ` + + R fsTreatmentR `db:"-" ` +} + +// FSTreatmentSlice is an alias for a slice of pointers to FSTreatment. +// This should almost always be used instead of []*FSTreatment. +type FSTreatmentSlice []*FSTreatment + +// FSTreatments contains methods to work with the fs_treatment table +var FSTreatments = psql.NewTablex[*FSTreatment, FSTreatmentSlice, *FSTreatmentSetter]("", "fs_treatment", buildFSTreatmentColumns("fs_treatment")) + +// FSTreatmentsQuery is a query on the fs_treatment table +type FSTreatmentsQuery = *psql.ViewQuery[*FSTreatment, FSTreatmentSlice] + +// fsTreatmentR is where relationships are stored. +type fsTreatmentR struct { + Organization *Organization // fs_treatment.fs_treatment_organization_id_fkey +} + +func buildFSTreatmentColumns(alias string) fsTreatmentColumns { + return fsTreatmentColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "activity", "areaunit", "avetemp", "barrierrouteid", "cbcount", "comments", "containercount", "creationdate", "creator", "enddatetime", "equiptype", "editdate", "editor", "fieldtech", "flowrate", "globalid", "habitat", "insp_id", "invloc", "linelocid", "locationname", "method", "objectid", "pointlocid", "polygonlocid", "product", "ptaid", "qty", "qtyunit", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "targetspecies", "tirecount", "treatacres", "treatarea", "treathectares", "treatmenthours", "treatmentlength", "treatmentlengthunits", "totalcostprodcut", "ulvrouteid", "warningoverride", "winddir", "windspeed", "zone", "zone2", "geometry_x", "geometry_y", "temp_sitecond", "updated", + ).WithParent("fs_treatment"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Areaunit: psql.Quote(alias, "areaunit"), + Avetemp: psql.Quote(alias, "avetemp"), + Barrierrouteid: psql.Quote(alias, "barrierrouteid"), + Cbcount: psql.Quote(alias, "cbcount"), + Comments: psql.Quote(alias, "comments"), + Containercount: psql.Quote(alias, "containercount"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Equiptype: psql.Quote(alias, "equiptype"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Flowrate: psql.Quote(alias, "flowrate"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + InspID: psql.Quote(alias, "insp_id"), + Invloc: psql.Quote(alias, "invloc"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Method: psql.Quote(alias, "method"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Product: psql.Quote(alias, "product"), + Ptaid: psql.Quote(alias, "ptaid"), + Qty: psql.Quote(alias, "qty"), + Qtyunit: psql.Quote(alias, "qtyunit"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sdid: psql.Quote(alias, "sdid"), + Sitecond: psql.Quote(alias, "sitecond"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Targetspecies: psql.Quote(alias, "targetspecies"), + Tirecount: psql.Quote(alias, "tirecount"), + Treatacres: psql.Quote(alias, "treatacres"), + Treatarea: psql.Quote(alias, "treatarea"), + Treathectares: psql.Quote(alias, "treathectares"), + Treatmenthours: psql.Quote(alias, "treatmenthours"), + Treatmentlength: psql.Quote(alias, "treatmentlength"), + Treatmentlengthunits: psql.Quote(alias, "treatmentlengthunits"), + Totalcostprodcut: psql.Quote(alias, "totalcostprodcut"), + Ulvrouteid: psql.Quote(alias, "ulvrouteid"), + Warningoverride: psql.Quote(alias, "warningoverride"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + TempSitecond: psql.Quote(alias, "temp_sitecond"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsTreatmentColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Areaunit psql.Expression + Avetemp psql.Expression + Barrierrouteid psql.Expression + Cbcount psql.Expression + Comments psql.Expression + Containercount psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Equiptype psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Flowrate psql.Expression + Globalid psql.Expression + Habitat psql.Expression + InspID psql.Expression + Invloc psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Method psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Product psql.Expression + Ptaid psql.Expression + Qty psql.Expression + Qtyunit psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sdid psql.Expression + Sitecond psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Targetspecies psql.Expression + Tirecount psql.Expression + Treatacres psql.Expression + Treatarea psql.Expression + Treathectares psql.Expression + Treatmenthours psql.Expression + Treatmentlength psql.Expression + Treatmentlengthunits psql.Expression + Totalcostprodcut psql.Expression + Ulvrouteid psql.Expression + Warningoverride psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + TempSitecond psql.Expression + Updated psql.Expression +} + +func (c fsTreatmentColumns) Alias() string { + return c.tableAlias +} + +func (fsTreatmentColumns) AliasedAs(alias string) fsTreatmentColumns { + return buildFSTreatmentColumns(alias) +} + +// FSTreatmentSetter is used for insert/upsert/update operations +// 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" ` + Activity omitnull.Val[string] `db:"activity" ` + Areaunit omitnull.Val[string] `db:"areaunit" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Barrierrouteid omitnull.Val[string] `db:"barrierrouteid" ` + 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" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Equiptype omitnull.Val[string] `db:"equiptype" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Flowrate omitnull.Val[float64] `db:"flowrate" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + InspID omitnull.Val[string] `db:"insp_id" ` + Invloc omitnull.Val[string] `db:"invloc" ` + Linelocid omitnull.Val[string] `db:"linelocid" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Method omitnull.Val[string] `db:"method" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` + Product omitnull.Val[string] `db:"product" ` + Ptaid omitnull.Val[string] `db:"ptaid" ` + Qty omitnull.Val[float64] `db:"qty" ` + Qtyunit omitnull.Val[string] `db:"qtyunit" ` + 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" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + Tirecount omitnull.Val[int16] `db:"tirecount" ` + Treatacres omitnull.Val[float64] `db:"treatacres" ` + Treatarea omitnull.Val[float64] `db:"treatarea" ` + Treathectares omitnull.Val[float64] `db:"treathectares" ` + Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` + Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` + Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` + Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` + Ulvrouteid omitnull.Val[string] `db:"ulvrouteid" ` + Warningoverride omitnull.Val[int16] `db:"warningoverride" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + TempSitecond omitnull.Val[string] `db:"temp_sitecond" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSTreatmentSetter) SetColumns() []string { + vals := make([]string, 0, 58) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Areaunit.IsUnset() { + vals = append(vals, "areaunit") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Barrierrouteid.IsUnset() { + vals = append(vals, "barrierrouteid") + } + if !s.Cbcount.IsUnset() { + vals = append(vals, "cbcount") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Containercount.IsUnset() { + vals = append(vals, "containercount") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Equiptype.IsUnset() { + vals = append(vals, "equiptype") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Flowrate.IsUnset() { + vals = append(vals, "flowrate") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.InspID.IsUnset() { + vals = append(vals, "insp_id") + } + if !s.Invloc.IsUnset() { + vals = append(vals, "invloc") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Method.IsUnset() { + vals = append(vals, "method") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Product.IsUnset() { + vals = append(vals, "product") + } + if !s.Ptaid.IsUnset() { + vals = append(vals, "ptaid") + } + if !s.Qty.IsUnset() { + vals = append(vals, "qty") + } + if !s.Qtyunit.IsUnset() { + vals = append(vals, "qtyunit") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sdid.IsUnset() { + vals = append(vals, "sdid") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Targetspecies.IsUnset() { + vals = append(vals, "targetspecies") + } + if !s.Tirecount.IsUnset() { + vals = append(vals, "tirecount") + } + if !s.Treatacres.IsUnset() { + vals = append(vals, "treatacres") + } + if !s.Treatarea.IsUnset() { + vals = append(vals, "treatarea") + } + if !s.Treathectares.IsUnset() { + vals = append(vals, "treathectares") + } + if !s.Treatmenthours.IsUnset() { + vals = append(vals, "treatmenthours") + } + if !s.Treatmentlength.IsUnset() { + vals = append(vals, "treatmentlength") + } + if !s.Treatmentlengthunits.IsUnset() { + vals = append(vals, "treatmentlengthunits") + } + if !s.Totalcostprodcut.IsUnset() { + vals = append(vals, "totalcostprodcut") + } + if !s.Ulvrouteid.IsUnset() { + vals = append(vals, "ulvrouteid") + } + if !s.Warningoverride.IsUnset() { + vals = append(vals, "warningoverride") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.TempSitecond.IsUnset() { + vals = append(vals, "temp_sitecond") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSTreatmentSetter) Overwrite(t *FSTreatment) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Areaunit.IsUnset() { + t.Areaunit = s.Areaunit.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Barrierrouteid.IsUnset() { + t.Barrierrouteid = s.Barrierrouteid.MustGetNull() + } + if !s.Cbcount.IsUnset() { + t.Cbcount = s.Cbcount.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Containercount.IsUnset() { + t.Containercount = s.Containercount.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Equiptype.IsUnset() { + t.Equiptype = s.Equiptype.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Flowrate.IsUnset() { + t.Flowrate = s.Flowrate.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.InspID.IsUnset() { + t.InspID = s.InspID.MustGetNull() + } + if !s.Invloc.IsUnset() { + t.Invloc = s.Invloc.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Method.IsUnset() { + t.Method = s.Method.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Product.IsUnset() { + t.Product = s.Product.MustGetNull() + } + if !s.Ptaid.IsUnset() { + t.Ptaid = s.Ptaid.MustGetNull() + } + if !s.Qty.IsUnset() { + t.Qty = s.Qty.MustGetNull() + } + if !s.Qtyunit.IsUnset() { + t.Qtyunit = s.Qtyunit.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sdid.IsUnset() { + t.Sdid = s.Sdid.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Targetspecies.IsUnset() { + t.Targetspecies = s.Targetspecies.MustGetNull() + } + if !s.Tirecount.IsUnset() { + t.Tirecount = s.Tirecount.MustGetNull() + } + if !s.Treatacres.IsUnset() { + t.Treatacres = s.Treatacres.MustGetNull() + } + if !s.Treatarea.IsUnset() { + t.Treatarea = s.Treatarea.MustGetNull() + } + if !s.Treathectares.IsUnset() { + t.Treathectares = s.Treathectares.MustGetNull() + } + if !s.Treatmenthours.IsUnset() { + t.Treatmenthours = s.Treatmenthours.MustGetNull() + } + if !s.Treatmentlength.IsUnset() { + t.Treatmentlength = s.Treatmentlength.MustGetNull() + } + if !s.Treatmentlengthunits.IsUnset() { + t.Treatmentlengthunits = s.Treatmentlengthunits.MustGetNull() + } + if !s.Totalcostprodcut.IsUnset() { + t.Totalcostprodcut = s.Totalcostprodcut.MustGetNull() + } + if !s.Ulvrouteid.IsUnset() { + t.Ulvrouteid = s.Ulvrouteid.MustGetNull() + } + if !s.Warningoverride.IsUnset() { + t.Warningoverride = s.Warningoverride.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.TempSitecond.IsUnset() { + t.TempSitecond = s.TempSitecond.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSTreatmentSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSTreatments.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, 58) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Areaunit.IsUnset() { + vals[2] = psql.Arg(s.Areaunit.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[3] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Barrierrouteid.IsUnset() { + vals[4] = psql.Arg(s.Barrierrouteid.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Cbcount.IsUnset() { + vals[5] = psql.Arg(s.Cbcount.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[6] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Containercount.IsUnset() { + vals[7] = psql.Arg(s.Containercount.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[8] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[9] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Equiptype.IsUnset() { + vals[11] = psql.Arg(s.Equiptype.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[12] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[13] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Flowrate.IsUnset() { + vals[15] = psql.Arg(s.Flowrate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[16] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[17] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.InspID.IsUnset() { + vals[18] = psql.Arg(s.InspID.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Invloc.IsUnset() { + vals[19] = psql.Arg(s.Invloc.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[20] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[21] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Method.IsUnset() { + vals[22] = psql.Arg(s.Method.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[23] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[24] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[25] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Product.IsUnset() { + vals[26] = psql.Arg(s.Product.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Ptaid.IsUnset() { + vals[27] = psql.Arg(s.Ptaid.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Qty.IsUnset() { + vals[28] = psql.Arg(s.Qty.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Qtyunit.IsUnset() { + vals[29] = psql.Arg(s.Qtyunit.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[30] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[31] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[32] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[33] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[34] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Sdid.IsUnset() { + vals[35] = psql.Arg(s.Sdid.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[36] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[37] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[38] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Targetspecies.IsUnset() { + vals[39] = psql.Arg(s.Targetspecies.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Tirecount.IsUnset() { + vals[40] = psql.Arg(s.Tirecount.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Treatacres.IsUnset() { + vals[41] = psql.Arg(s.Treatacres.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Treatarea.IsUnset() { + vals[42] = psql.Arg(s.Treatarea.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Treathectares.IsUnset() { + vals[43] = psql.Arg(s.Treathectares.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Treatmenthours.IsUnset() { + vals[44] = psql.Arg(s.Treatmenthours.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Treatmentlength.IsUnset() { + vals[45] = psql.Arg(s.Treatmentlength.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Treatmentlengthunits.IsUnset() { + vals[46] = psql.Arg(s.Treatmentlengthunits.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Totalcostprodcut.IsUnset() { + vals[47] = psql.Arg(s.Totalcostprodcut.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Ulvrouteid.IsUnset() { + vals[48] = psql.Arg(s.Ulvrouteid.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Warningoverride.IsUnset() { + vals[49] = psql.Arg(s.Warningoverride.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[50] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[51] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[52] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[53] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[54] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[55] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.TempSitecond.IsUnset() { + vals[56] = psql.Arg(s.TempSitecond.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[57] = psql.Arg(s.Updated.MustGet()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSTreatmentSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 58) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Areaunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "areaunit")...), + psql.Arg(s.Areaunit), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Barrierrouteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "barrierrouteid")...), + psql.Arg(s.Barrierrouteid), + }}) + } + + if !s.Cbcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cbcount")...), + psql.Arg(s.Cbcount), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Containercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containercount")...), + psql.Arg(s.Containercount), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Equiptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "equiptype")...), + psql.Arg(s.Equiptype), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Flowrate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flowrate")...), + psql.Arg(s.Flowrate), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.InspID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "insp_id")...), + psql.Arg(s.InspID), + }}) + } + + if !s.Invloc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "invloc")...), + psql.Arg(s.Invloc), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Method.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "method")...), + psql.Arg(s.Method), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Product.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "product")...), + psql.Arg(s.Product), + }}) + } + + if !s.Ptaid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ptaid")...), + psql.Arg(s.Ptaid), + }}) + } + + if !s.Qty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "qty")...), + psql.Arg(s.Qty), + }}) + } + + if !s.Qtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "qtyunit")...), + psql.Arg(s.Qtyunit), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sdid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sdid")...), + psql.Arg(s.Sdid), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Targetspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetspecies")...), + psql.Arg(s.Targetspecies), + }}) + } + + if !s.Tirecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "tirecount")...), + psql.Arg(s.Tirecount), + }}) + } + + if !s.Treatacres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatacres")...), + psql.Arg(s.Treatacres), + }}) + } + + if !s.Treatarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatarea")...), + psql.Arg(s.Treatarea), + }}) + } + + if !s.Treathectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treathectares")...), + psql.Arg(s.Treathectares), + }}) + } + + if !s.Treatmenthours.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmenthours")...), + psql.Arg(s.Treatmenthours), + }}) + } + + if !s.Treatmentlength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentlength")...), + psql.Arg(s.Treatmentlength), + }}) + } + + if !s.Treatmentlengthunits.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentlengthunits")...), + psql.Arg(s.Treatmentlengthunits), + }}) + } + + if !s.Totalcostprodcut.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totalcostprodcut")...), + psql.Arg(s.Totalcostprodcut), + }}) + } + + if !s.Ulvrouteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ulvrouteid")...), + psql.Arg(s.Ulvrouteid), + }}) + } + + if !s.Warningoverride.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "warningoverride")...), + psql.Arg(s.Warningoverride), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.TempSitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "temp_sitecond")...), + psql.Arg(s.TempSitecond), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSTreatment retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSTreatment(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTreatment, error) { + if len(cols) == 0 { + return FSTreatments.Query( + sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSTreatments.Query( + sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSTreatments.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSTreatmentExists checks the presence of a single record by primary key +func FSTreatmentExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSTreatments.Query( + sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSTreatment is retrieved from the database +func (o *FSTreatment) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTreatments.AfterSelectHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSTreatments.AfterInsertHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSTreatment +func (o *FSTreatment) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSTreatment) pkEQ() dialect.Expression { + return psql.Quote("fs_treatment", "objectid").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 FSTreatment +func (o *FSTreatment) Update(ctx context.Context, exec bob.Executor, s *FSTreatmentSetter) error { + v, err := FSTreatments.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 FSTreatment record with an executor +func (o *FSTreatment) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSTreatments.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSTreatment using the executor +func (o *FSTreatment) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSTreatments.Query( + sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSTreatmentSlice is retrieved from the database +func (o FSTreatmentSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTreatments.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSTreatments.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSTreatmentSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_treatment", "objectid").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 FSTreatmentSlice) copyMatchingRows(from ...*FSTreatment) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSTreatmentSlice) 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 FSTreatments.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 *FSTreatment: + o.copyMatchingRows(retrieved) + case []*FSTreatment: + o.copyMatchingRows(retrieved...) + case FSTreatmentSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTreatment or a slice of FSTreatment + // then run the AfterUpdateHooks on the slice + _, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSTreatmentSlice) 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 FSTreatments.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 *FSTreatment: + o.copyMatchingRows(retrieved) + case []*FSTreatment: + o.copyMatchingRows(retrieved...) + case FSTreatmentSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTreatment or a slice of FSTreatment + // then run the AfterDeleteHooks on the slice + _, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSTreatmentSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTreatmentSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSTreatments.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSTreatmentSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSTreatments.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSTreatmentSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSTreatments.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 *FSTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatment0 *FSTreatment, organization1 *Organization) (*FSTreatment, error) { + setter := &FSTreatmentSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsTreatment0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSTreatmentOrganization0: %w", err) + } + + return fsTreatment0, nil +} + +func (fsTreatment0 *FSTreatment) 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 = attachFSTreatmentOrganization0(ctx, exec, 1, fsTreatment0, organization1) + if err != nil { + return err + } + + fsTreatment0.R.Organization = organization1 + + organization1.R.FSTreatments = append(organization1.R.FSTreatments, fsTreatment0) + + return nil +} + +func (fsTreatment0 *FSTreatment) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSTreatmentOrganization0(ctx, exec, 1, fsTreatment0, organization1) + if err != nil { + return err + } + + fsTreatment0.R.Organization = organization1 + + organization1.R.FSTreatments = append(organization1.R.FSTreatments, fsTreatment0) + + return nil +} + +type fsTreatmentWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Areaunit psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Barrierrouteid psql.WhereNullMod[Q, string] + Cbcount psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Containercount psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Equiptype psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Flowrate psql.WhereNullMod[Q, float64] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + InspID psql.WhereNullMod[Q, string] + Invloc psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Method psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Product psql.WhereNullMod[Q, string] + Ptaid psql.WhereNullMod[Q, string] + Qty psql.WhereNullMod[Q, float64] + Qtyunit psql.WhereNullMod[Q, string] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sdid psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Targetspecies psql.WhereNullMod[Q, string] + Tirecount psql.WhereNullMod[Q, int16] + Treatacres psql.WhereNullMod[Q, float64] + Treatarea psql.WhereNullMod[Q, float64] + Treathectares psql.WhereNullMod[Q, float64] + Treatmenthours psql.WhereNullMod[Q, float64] + Treatmentlength psql.WhereNullMod[Q, float64] + Treatmentlengthunits psql.WhereNullMod[Q, string] + Totalcostprodcut psql.WhereNullMod[Q, float64] + Ulvrouteid psql.WhereNullMod[Q, string] + Warningoverride psql.WhereNullMod[Q, int16] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + TempSitecond psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsTreatmentWhere[Q]) AliasedAs(alias string) fsTreatmentWhere[Q] { + return buildFSTreatmentWhere[Q](buildFSTreatmentColumns(alias)) +} + +func buildFSTreatmentWhere[Q psql.Filterable](cols fsTreatmentColumns) fsTreatmentWhere[Q] { + return fsTreatmentWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Barrierrouteid: psql.WhereNull[Q, string](cols.Barrierrouteid), + Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), + Comments: psql.WhereNull[Q, string](cols.Comments), + Containercount: psql.WhereNull[Q, int16](cols.Containercount), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Flowrate: psql.WhereNull[Q, float64](cols.Flowrate), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + InspID: psql.WhereNull[Q, string](cols.InspID), + Invloc: psql.WhereNull[Q, string](cols.Invloc), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Method: psql.WhereNull[Q, string](cols.Method), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Product: psql.WhereNull[Q, string](cols.Product), + Ptaid: psql.WhereNull[Q, string](cols.Ptaid), + Qty: psql.WhereNull[Q, float64](cols.Qty), + Qtyunit: psql.WhereNull[Q, string](cols.Qtyunit), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sdid: psql.WhereNull[Q, string](cols.Sdid), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), + Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), + Treatacres: psql.WhereNull[Q, float64](cols.Treatacres), + Treatarea: psql.WhereNull[Q, float64](cols.Treatarea), + Treathectares: psql.WhereNull[Q, float64](cols.Treathectares), + Treatmenthours: psql.WhereNull[Q, float64](cols.Treatmenthours), + Treatmentlength: psql.WhereNull[Q, float64](cols.Treatmentlength), + Treatmentlengthunits: psql.WhereNull[Q, string](cols.Treatmentlengthunits), + Totalcostprodcut: psql.WhereNull[Q, float64](cols.Totalcostprodcut), + Ulvrouteid: psql.WhereNull[Q, string](cols.Ulvrouteid), + Warningoverride: psql.WhereNull[Q, int16](cols.Warningoverride), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + TempSitecond: psql.WhereNull[Q, string](cols.TempSitecond), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSTreatment) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsTreatment cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSTreatments = FSTreatmentSlice{o} + } + return nil + default: + return fmt.Errorf("fsTreatment has no relationship %q", name) + } +} + +type fsTreatmentPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSTreatmentPreloader() fsTreatmentPreloader { + return fsTreatmentPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSTreatments, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsTreatmentThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSTreatmentThenLoader[Q orm.Loadable]() fsTreatmentThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsTreatmentThenLoader[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 fsTreatment's Organization into the .R struct +func (o *FSTreatment) 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.FSTreatments = FSTreatmentSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsTreatment's Organization into the .R struct +func (os FSTreatmentSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSTreatments = append(rel.R.FSTreatments, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsTreatmentJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsTreatmentJoins[Q]) aliasedAs(alias string) fsTreatmentJoins[Q] { + return buildFSTreatmentJoins[Q](buildFSTreatmentColumns(alias), j.typ) +} + +func buildFSTreatmentJoins[Q dialect.Joinable](cols fsTreatmentColumns, typ string) fsTreatmentJoins[Q] { + return fsTreatmentJoins[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_treatmentarea.bob.go b/models/fs_treatmentarea.bob.go new file mode 100644 index 00000000..fde45600 --- /dev/null +++ b/models/fs_treatmentarea.bob.go @@ -0,0 +1,1108 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSTreatmentarea is an object representing the database table. +type FSTreatmentarea 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" ` + Updated time.Time `db:"updated" ` + + R fsTreatmentareaR `db:"-" ` +} + +// FSTreatmentareaSlice is an alias for a slice of pointers to FSTreatmentarea. +// This should almost always be used instead of []*FSTreatmentarea. +type FSTreatmentareaSlice []*FSTreatmentarea + +// FSTreatmentareas contains methods to work with the fs_treatmentarea table +var FSTreatmentareas = psql.NewTablex[*FSTreatmentarea, FSTreatmentareaSlice, *FSTreatmentareaSetter]("", "fs_treatmentarea", buildFSTreatmentareaColumns("fs_treatmentarea")) + +// FSTreatmentareasQuery is a query on the fs_treatmentarea table +type FSTreatmentareasQuery = *psql.ViewQuery[*FSTreatmentarea, FSTreatmentareaSlice] + +// fsTreatmentareaR is where relationships are stored. +type fsTreatmentareaR struct { + Organization *Organization // fs_treatmentarea.fs_treatmentarea_organization_id_fkey +} + +func buildFSTreatmentareaColumns(alias string) fsTreatmentareaColumns { + return fsTreatmentareaColumns{ + 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", "updated", + ).WithParent("fs_treatmentarea"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Notified: psql.Quote(alias, "notified"), + Objectid: psql.Quote(alias, "objectid"), + SessionID: psql.Quote(alias, "session_id"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Treatdate: psql.Quote(alias, "treatdate"), + TreatID: psql.Quote(alias, "treat_id"), + Type: psql.Quote(alias, "type"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsTreatmentareaColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Notified psql.Expression + Objectid psql.Expression + SessionID psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Treatdate psql.Expression + TreatID psql.Expression + Type psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsTreatmentareaColumns) Alias() string { + return c.tableAlias +} + +func (fsTreatmentareaColumns) AliasedAs(alias string) fsTreatmentareaColumns { + return buildFSTreatmentareaColumns(alias) +} + +// FSTreatmentareaSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSTreatmentareaSetter) SetColumns() []string { + vals := make([]string, 0, 22) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Notified.IsUnset() { + vals = append(vals, "notified") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.SessionID.IsUnset() { + vals = append(vals, "session_id") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Treatdate.IsUnset() { + vals = append(vals, "treatdate") + } + if !s.TreatID.IsUnset() { + vals = append(vals, "treat_id") + } + if !s.Type.IsUnset() { + vals = append(vals, "type") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSTreatmentareaSetter) Overwrite(t *FSTreatmentarea) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Notified.IsUnset() { + t.Notified = s.Notified.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.SessionID.IsUnset() { + t.SessionID = s.SessionID.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Treatdate.IsUnset() { + t.Treatdate = s.Treatdate.MustGetNull() + } + if !s.TreatID.IsUnset() { + t.TreatID = s.TreatID.MustGetNull() + } + if !s.Type.IsUnset() { + t.Type = s.Type.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSTreatmentareaSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSTreatmentareas.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, 22) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Notified.IsUnset() { + vals[7] = psql.Arg(s.Notified.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.SessionID.IsUnset() { + vals[9] = psql.Arg(s.SessionID.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[10] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[11] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Treatdate.IsUnset() { + vals[12] = psql.Arg(s.Treatdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.TreatID.IsUnset() { + vals[13] = psql.Arg(s.TreatID.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Type.IsUnset() { + vals[14] = psql.Arg(s.Type.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[15] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[16] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[17] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[18] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[19] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[20] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[21] = psql.Arg(s.Updated.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 22) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Notified.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notified")...), + psql.Arg(s.Notified), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.SessionID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "session_id")...), + psql.Arg(s.SessionID), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Treatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatdate")...), + psql.Arg(s.Treatdate), + }}) + } + + if !s.TreatID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treat_id")...), + psql.Arg(s.TreatID), + }}) + } + + if !s.Type.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type")...), + psql.Arg(s.Type), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSTreatmentarea retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTreatmentarea, error) { + if len(cols) == 0 { + return FSTreatmentareas.Query( + sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSTreatmentareas.Query( + sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSTreatmentareas.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSTreatmentareaExists checks the presence of a single record by primary key +func FSTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSTreatmentareas.Query( + sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSTreatmentarea is retrieved from the database +func (o *FSTreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSTreatmentarea +func (o *FSTreatmentarea) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSTreatmentarea) pkEQ() dialect.Expression { + return psql.Quote("fs_treatmentarea", "objectid").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 FSTreatmentarea +func (o *FSTreatmentarea) Update(ctx context.Context, exec bob.Executor, s *FSTreatmentareaSetter) error { + v, err := FSTreatmentareas.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 FSTreatmentarea record with an executor +func (o *FSTreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSTreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSTreatmentarea using the executor +func (o *FSTreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSTreatmentareas.Query( + sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSTreatmentareaSlice is retrieved from the database +func (o FSTreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSTreatmentareaSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_treatmentarea", "objectid").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 FSTreatmentareaSlice) copyMatchingRows(from ...*FSTreatmentarea) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSTreatmentareaSlice) 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 FSTreatmentareas.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 *FSTreatmentarea: + o.copyMatchingRows(retrieved) + case []*FSTreatmentarea: + o.copyMatchingRows(retrieved...) + case FSTreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTreatmentarea or a slice of FSTreatmentarea + // then run the AfterUpdateHooks on the slice + _, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSTreatmentareaSlice) 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 FSTreatmentareas.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 *FSTreatmentarea: + o.copyMatchingRows(retrieved) + case []*FSTreatmentarea: + o.copyMatchingRows(retrieved...) + case FSTreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSTreatmentarea or a slice of FSTreatmentarea + // then run the AfterDeleteHooks on the slice + _, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSTreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTreatmentareaSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSTreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSTreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSTreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSTreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSTreatmentareas.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 *FSTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatmentarea0 *FSTreatmentarea, organization1 *Organization) (*FSTreatmentarea, error) { + setter := &FSTreatmentareaSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsTreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSTreatmentareaOrganization0: %w", err) + } + + return fsTreatmentarea0, nil +} + +func (fsTreatmentarea0 *FSTreatmentarea) 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 = attachFSTreatmentareaOrganization0(ctx, exec, 1, fsTreatmentarea0, organization1) + if err != nil { + return err + } + + fsTreatmentarea0.R.Organization = organization1 + + organization1.R.FSTreatmentareas = append(organization1.R.FSTreatmentareas, fsTreatmentarea0) + + return nil +} + +func (fsTreatmentarea0 *FSTreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSTreatmentareaOrganization0(ctx, exec, 1, fsTreatmentarea0, organization1) + if err != nil { + return err + } + + fsTreatmentarea0.R.Organization = organization1 + + organization1.R.FSTreatmentareas = append(organization1.R.FSTreatmentareas, fsTreatmentarea0) + + return nil +} + +type fsTreatmentareaWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Notified psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + SessionID psql.WhereNullMod[Q, string] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Treatdate psql.WhereNullMod[Q, int64] + TreatID psql.WhereNullMod[Q, string] + Type psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsTreatmentareaWhere[Q]) AliasedAs(alias string) fsTreatmentareaWhere[Q] { + return buildFSTreatmentareaWhere[Q](buildFSTreatmentareaColumns(alias)) +} + +func buildFSTreatmentareaWhere[Q psql.Filterable](cols fsTreatmentareaColumns) fsTreatmentareaWhere[Q] { + return fsTreatmentareaWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Notified: psql.WhereNull[Q, int16](cols.Notified), + Objectid: psql.Where[Q, int32](cols.Objectid), + SessionID: psql.WhereNull[Q, string](cols.SessionID), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Treatdate: psql.WhereNull[Q, int64](cols.Treatdate), + TreatID: psql.WhereNull[Q, string](cols.TreatID), + Type: psql.WhereNull[Q, string](cols.Type), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSTreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsTreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSTreatmentareas = FSTreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("fsTreatmentarea has no relationship %q", name) + } +} + +type fsTreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSTreatmentareaPreloader() fsTreatmentareaPreloader { + return fsTreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSTreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsTreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSTreatmentareaThenLoader[Q orm.Loadable]() fsTreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsTreatmentareaThenLoader[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 fsTreatmentarea's Organization into the .R struct +func (o *FSTreatmentarea) 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.FSTreatmentareas = FSTreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsTreatmentarea's Organization into the .R struct +func (os FSTreatmentareaSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSTreatmentareas = append(rel.R.FSTreatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsTreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsTreatmentareaJoins[Q]) aliasedAs(alias string) fsTreatmentareaJoins[Q] { + return buildFSTreatmentareaJoins[Q](buildFSTreatmentareaColumns(alias), j.typ) +} + +func buildFSTreatmentareaJoins[Q dialect.Joinable](cols fsTreatmentareaColumns, typ string) fsTreatmentareaJoins[Q] { + return fsTreatmentareaJoins[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_zones.bob.go b/models/fs_zones.bob.go new file mode 100644 index 00000000..0160b6e4 --- /dev/null +++ b/models/fs_zones.bob.go @@ -0,0 +1,1008 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSZone is an object representing the database table. +type FSZone 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" ` + Updated time.Time `db:"updated" ` + + R fsZoneR `db:"-" ` +} + +// FSZoneSlice is an alias for a slice of pointers to FSZone. +// This should almost always be used instead of []*FSZone. +type FSZoneSlice []*FSZone + +// FSZones contains methods to work with the fs_zones table +var FSZones = psql.NewTablex[*FSZone, FSZoneSlice, *FSZoneSetter]("", "fs_zones", buildFSZoneColumns("fs_zones")) + +// FSZonesQuery is a query on the fs_zones table +type FSZonesQuery = *psql.ViewQuery[*FSZone, FSZoneSlice] + +// fsZoneR is where relationships are stored. +type fsZoneR struct { + Organization *Organization // fs_zones.fs_zones_organization_id_fkey +} + +func buildFSZoneColumns(alias string) fsZoneColumns { + return fsZoneColumns{ + 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", "updated", + ).WithParent("fs_zones"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Active: psql.Quote(alias, "active"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsZoneColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Active psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Name psql.Expression + Objectid psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsZoneColumns) Alias() string { + return c.tableAlias +} + +func (fsZoneColumns) AliasedAs(alias string) fsZoneColumns { + return buildFSZoneColumns(alias) +} + +// FSZoneSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSZoneSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSZoneSetter) Overwrite(t *FSZone) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSZoneSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSZones.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[1] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[7] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[9] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[10] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[17] = psql.Arg(s.Updated.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSZoneSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSZone retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSZone(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSZone, error) { + if len(cols) == 0 { + return FSZones.Query( + sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSZones.Query( + sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSZones.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSZoneExists checks the presence of a single record by primary key +func FSZoneExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSZones.Query( + sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSZone is retrieved from the database +func (o *FSZone) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSZones.AfterSelectHooks.RunHooks(ctx, exec, FSZoneSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FSZones.AfterInsertHooks.RunHooks(ctx, exec, FSZoneSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, FSZoneSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, FSZoneSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSZone +func (o *FSZone) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSZone) pkEQ() dialect.Expression { + return psql.Quote("fs_zones", "objectid").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 FSZone +func (o *FSZone) Update(ctx context.Context, exec bob.Executor, s *FSZoneSetter) error { + v, err := FSZones.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 FSZone record with an executor +func (o *FSZone) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSZones.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSZone using the executor +func (o *FSZone) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSZones.Query( + sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSZoneSlice is retrieved from the database +func (o FSZoneSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSZones.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSZones.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSZoneSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_zones", "objectid").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 FSZoneSlice) copyMatchingRows(from ...*FSZone) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSZoneSlice) 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 FSZones.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 *FSZone: + o.copyMatchingRows(retrieved) + case []*FSZone: + o.copyMatchingRows(retrieved...) + case FSZoneSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSZone or a slice of FSZone + // then run the AfterUpdateHooks on the slice + _, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSZoneSlice) 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 FSZones.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 *FSZone: + o.copyMatchingRows(retrieved) + case []*FSZone: + o.copyMatchingRows(retrieved...) + case FSZoneSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSZone or a slice of FSZone + // then run the AfterDeleteHooks on the slice + _, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSZoneSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSZoneSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FSZones.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSZoneSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSZones.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSZoneSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSZones.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 *FSZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSZoneOrganization0(ctx context.Context, exec bob.Executor, count int, fsZone0 *FSZone, organization1 *Organization) (*FSZone, error) { + setter := &FSZoneSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsZone0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSZoneOrganization0: %w", err) + } + + return fsZone0, nil +} + +func (fsZone0 *FSZone) 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 = attachFSZoneOrganization0(ctx, exec, 1, fsZone0, organization1) + if err != nil { + return err + } + + fsZone0.R.Organization = organization1 + + organization1.R.FSZones = append(organization1.R.FSZones, fsZone0) + + return nil +} + +func (fsZone0 *FSZone) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSZoneOrganization0(ctx, exec, 1, fsZone0, organization1) + if err != nil { + return err + } + + fsZone0.R.Organization = organization1 + + organization1.R.FSZones = append(organization1.R.FSZones, fsZone0) + + return nil +} + +type fsZoneWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Active psql.WhereNullMod[Q, int64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsZoneWhere[Q]) AliasedAs(alias string) fsZoneWhere[Q] { + return buildFSZoneWhere[Q](buildFSZoneColumns(alias)) +} + +func buildFSZoneWhere[Q psql.Filterable](cols fsZoneColumns) fsZoneWhere[Q] { + return fsZoneWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSZone) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsZone cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSZones = FSZoneSlice{o} + } + return nil + default: + return fmt.Errorf("fsZone has no relationship %q", name) + } +} + +type fsZonePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSZonePreloader() fsZonePreloader { + return fsZonePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSZones, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsZoneThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSZoneThenLoader[Q orm.Loadable]() fsZoneThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsZoneThenLoader[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 fsZone's Organization into the .R struct +func (o *FSZone) 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.FSZones = FSZoneSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsZone's Organization into the .R struct +func (os FSZoneSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSZones = append(rel.R.FSZones, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsZoneJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsZoneJoins[Q]) aliasedAs(alias string) fsZoneJoins[Q] { + return buildFSZoneJoins[Q](buildFSZoneColumns(alias), j.typ) +} + +func buildFSZoneJoins[Q dialect.Joinable](cols fsZoneColumns, typ string) fsZoneJoins[Q] { + return fsZoneJoins[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_zones2.bob.go b/models/fs_zones2.bob.go new file mode 100644 index 00000000..616f7155 --- /dev/null +++ b/models/fs_zones2.bob.go @@ -0,0 +1,983 @@ +// 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/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// FSZones2 is an object representing the database table. +type FSZones2 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" ` + Updated time.Time `db:"updated" ` + + R fsZones2R `db:"-" ` +} + +// FSZones2Slice is an alias for a slice of pointers to FSZones2. +// This should almost always be used instead of []*FSZones2. +type FSZones2Slice []*FSZones2 + +// FSZones2s contains methods to work with the fs_zones2 table +var FSZones2s = psql.NewTablex[*FSZones2, FSZones2Slice, *FSZones2Setter]("", "fs_zones2", buildFSZones2Columns("fs_zones2")) + +// FSZones2sQuery is a query on the fs_zones2 table +type FSZones2sQuery = *psql.ViewQuery[*FSZones2, FSZones2Slice] + +// fsZones2R is where relationships are stored. +type fsZones2R struct { + Organization *Organization // fs_zones2.fs_zones2_organization_id_fkey +} + +func buildFSZones2Columns(alias string) fsZones2Columns { + return fsZones2Columns{ + 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", "updated", + ).WithParent("fs_zones2"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Updated: psql.Quote(alias, "updated"), + } +} + +type fsZones2Columns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Name psql.Expression + Objectid psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Updated psql.Expression +} + +func (c fsZones2Columns) Alias() string { + return c.tableAlias +} + +func (fsZones2Columns) AliasedAs(alias string) fsZones2Columns { + return buildFSZones2Columns(alias) +} + +// FSZones2Setter is used for insert/upsert/update operations +// 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" ` + 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" ` + Updated omit.Val[time.Time] `db:"updated" ` +} + +func (s FSZones2Setter) SetColumns() []string { + vals := make([]string, 0, 17) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Updated.IsValue() { + vals = append(vals, "updated") + } + return vals +} + +func (s FSZones2Setter) Overwrite(t *FSZones2) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Updated.IsValue() { + t.Updated = s.Updated.MustGet() + } +} + +func (s *FSZones2Setter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FSZones2s.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, 17) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[6] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[7] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[8] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[9] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[12] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[13] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Updated.IsValue() { + vals[16] = psql.Arg(s.Updated.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FSZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FSZones2Setter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 17) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Updated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "updated")...), + psql.Arg(s.Updated), + }}) + } + + return exprs +} + +// FindFSZones2 retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFSZones2(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSZones2, error) { + if len(cols) == 0 { + return FSZones2s.Query( + sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).One(ctx, exec) + } + + return FSZones2s.Query( + sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Columns(FSZones2s.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FSZones2Exists checks the presence of a single record by primary key +func FSZones2Exists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { + return FSZones2s.Query( + sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FSZones2 is retrieved from the database +func (o *FSZones2) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSZones2s.AfterSelectHooks.RunHooks(ctx, exec, FSZones2Slice{o}) + case bob.QueryTypeInsert: + ctx, err = FSZones2s.AfterInsertHooks.RunHooks(ctx, exec, FSZones2Slice{o}) + case bob.QueryTypeUpdate: + ctx, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, FSZones2Slice{o}) + case bob.QueryTypeDelete: + ctx, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, FSZones2Slice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FSZones2 +func (o *FSZones2) primaryKeyVals() bob.Expression { + return psql.Arg(o.Objectid) +} + +func (o *FSZones2) pkEQ() dialect.Expression { + return psql.Quote("fs_zones2", "objectid").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 FSZones2 +func (o *FSZones2) Update(ctx context.Context, exec bob.Executor, s *FSZones2Setter) error { + v, err := FSZones2s.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 FSZones2 record with an executor +func (o *FSZones2) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FSZones2s.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FSZones2 using the executor +func (o *FSZones2) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FSZones2s.Query( + sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FSZones2Slice is retrieved from the database +func (o FSZones2Slice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FSZones2s.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FSZones2s.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FSZones2Slice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fs_zones2", "objectid").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 FSZones2Slice) copyMatchingRows(from ...*FSZones2) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FSZones2Slice) 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 FSZones2s.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 *FSZones2: + o.copyMatchingRows(retrieved) + case []*FSZones2: + o.copyMatchingRows(retrieved...) + case FSZones2Slice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSZones2 or a slice of FSZones2 + // then run the AfterUpdateHooks on the slice + _, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FSZones2Slice) 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 FSZones2s.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 *FSZones2: + o.copyMatchingRows(retrieved) + case []*FSZones2: + o.copyMatchingRows(retrieved...) + case FSZones2Slice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FSZones2 or a slice of FSZones2 + // then run the AfterDeleteHooks on the slice + _, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FSZones2Slice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSZones2Setter) error { + if len(o) == 0 { + return nil + } + + _, err := FSZones2s.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FSZones2Slice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FSZones2s.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FSZones2Slice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FSZones2s.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 *FSZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FSZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachFSZones2Organization0(ctx context.Context, exec bob.Executor, count int, fsZones20 *FSZones2, organization1 *Organization) (*FSZones2, error) { + setter := &FSZones2Setter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := fsZones20.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFSZones2Organization0: %w", err) + } + + return fsZones20, nil +} + +func (fsZones20 *FSZones2) 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 = attachFSZones2Organization0(ctx, exec, 1, fsZones20, organization1) + if err != nil { + return err + } + + fsZones20.R.Organization = organization1 + + organization1.R.FSZones2s = append(organization1.R.FSZones2s, fsZones20) + + return nil +} + +func (fsZones20 *FSZones2) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFSZones2Organization0(ctx, exec, 1, fsZones20, organization1) + if err != nil { + return err + } + + fsZones20.R.Organization = organization1 + + organization1.R.FSZones2s = append(organization1.R.FSZones2s, fsZones20) + + return nil +} + +type fsZones2Where[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Updated psql.WhereMod[Q, time.Time] +} + +func (fsZones2Where[Q]) AliasedAs(alias string) fsZones2Where[Q] { + return buildFSZones2Where[Q](buildFSZones2Columns(alias)) +} + +func buildFSZones2Where[Q psql.Filterable](cols fsZones2Columns) fsZones2Where[Q] { + return fsZones2Where[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Updated: psql.Where[Q, time.Time](cols.Updated), + } +} + +func (o *FSZones2) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fsZones2 cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FSZones2s = FSZones2Slice{o} + } + return nil + default: + return fmt.Errorf("fsZones2 has no relationship %q", name) + } +} + +type fsZones2Preloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFSZones2Preloader() fsZones2Preloader { + return fsZones2Preloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FSZones2s, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fsZones2ThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFSZones2ThenLoader[Q orm.Loadable]() fsZones2ThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fsZones2ThenLoader[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 fsZones2's Organization into the .R struct +func (o *FSZones2) 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.FSZones2s = FSZones2Slice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fsZones2's Organization into the .R struct +func (os FSZones2Slice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.FSZones2s = append(rel.R.FSZones2s, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fsZones2Joins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fsZones2Joins[Q]) aliasedAs(alias string) fsZones2Joins[Q] { + return buildFSZones2Joins[Q](buildFSZones2Columns(alias), j.typ) +} + +func buildFSZones2Joins[Q dialect.Joinable](cols fsZones2Columns, typ string) fsZones2Joins[Q] { + return fsZones2Joins[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/history_containerrelate.bob.go b/models/history_containerrelate.bob.go new file mode 100644 index 00000000..ca5d1343 --- /dev/null +++ b/models/history_containerrelate.bob.go @@ -0,0 +1,1017 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyContainerrelateR `db:"-" ` +} + +// HistoryContainerrelateSlice is an alias for a slice of pointers to HistoryContainerrelate. +// This should almost always be used instead of []*HistoryContainerrelate. +type HistoryContainerrelateSlice []*HistoryContainerrelate + +// HistoryContainerrelates contains methods to work with the history_containerrelate table +var HistoryContainerrelates = psql.NewTablex[*HistoryContainerrelate, HistoryContainerrelateSlice, *HistoryContainerrelateSetter]("", "history_containerrelate", buildHistoryContainerrelateColumns("history_containerrelate")) + +// HistoryContainerrelatesQuery is a query on the history_containerrelate table +type HistoryContainerrelatesQuery = *psql.ViewQuery[*HistoryContainerrelate, HistoryContainerrelateSlice] + +// historyContainerrelateR is where relationships are stored. +type historyContainerrelateR struct { + Organization *Organization // history_containerrelate.history_containerrelate_organization_id_fkey +} + +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", + ).WithParent("history_containerrelate"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Containertype: psql.Quote(alias, "containertype"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Inspsampleid: psql.Quote(alias, "inspsampleid"), + Mosquitoinspid: psql.Quote(alias, "mosquitoinspid"), + Objectid: psql.Quote(alias, "objectid"), + Treatmentid: psql.Quote(alias, "treatmentid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyContainerrelateColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Containertype psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Inspsampleid psql.Expression + Mosquitoinspid psql.Expression + Objectid psql.Expression + Treatmentid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyContainerrelateColumns) Alias() string { + return c.tableAlias +} + +func (historyContainerrelateColumns) AliasedAs(alias string) historyContainerrelateColumns { + return buildHistoryContainerrelateColumns(alias) +} + +// HistoryContainerrelateSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryContainerrelateSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Containertype.IsUnset() { + vals = append(vals, "containertype") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Inspsampleid.IsUnset() { + vals = append(vals, "inspsampleid") + } + if !s.Mosquitoinspid.IsUnset() { + vals = append(vals, "mosquitoinspid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Treatmentid.IsUnset() { + vals = append(vals, "treatmentid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryContainerrelateSetter) Overwrite(t *HistoryContainerrelate) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Containertype.IsUnset() { + t.Containertype = s.Containertype.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Inspsampleid.IsUnset() { + t.Inspsampleid = s.Inspsampleid.MustGetNull() + } + if !s.Mosquitoinspid.IsUnset() { + t.Mosquitoinspid = s.Mosquitoinspid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Treatmentid.IsUnset() { + t.Treatmentid = s.Treatmentid.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryContainerrelateSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryContainerrelates.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Containertype.IsUnset() { + vals[1] = psql.Arg(s.Containertype.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Inspsampleid.IsUnset() { + vals[7] = psql.Arg(s.Inspsampleid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Mosquitoinspid.IsUnset() { + vals[8] = psql.Arg(s.Mosquitoinspid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[9] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Treatmentid.IsUnset() { + vals[10] = psql.Arg(s.Treatmentid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Containertype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containertype")...), + psql.Arg(s.Containertype), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Inspsampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "inspsampleid")...), + psql.Arg(s.Inspsampleid), + }}) + } + + if !s.Mosquitoinspid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "mosquitoinspid")...), + psql.Arg(s.Mosquitoinspid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Treatmentid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentid")...), + psql.Arg(s.Treatmentid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryContainerrelate retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryContainerrelate, error) { + if len(cols) == 0 { + return HistoryContainerrelates.Query( + sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryContainerrelates.Query( + sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryContainerrelates.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryContainerrelateExists checks the presence of a single record by primary key +func HistoryContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryContainerrelates.Query( + sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryContainerrelate is retrieved from the database +func (o *HistoryContainerrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryContainerrelate +func (o *HistoryContainerrelate) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryContainerrelate) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_containerrelate", "objectid"), psql.Quote("history_containerrelate", "version")).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 HistoryContainerrelate +func (o *HistoryContainerrelate) Update(ctx context.Context, exec bob.Executor, s *HistoryContainerrelateSetter) error { + v, err := HistoryContainerrelates.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 HistoryContainerrelate record with an executor +func (o *HistoryContainerrelate) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryContainerrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryContainerrelate using the executor +func (o *HistoryContainerrelate) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryContainerrelates.Query( + sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryContainerrelateSlice is retrieved from the database +func (o HistoryContainerrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryContainerrelateSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_containerrelate", "objectid"), psql.Quote("history_containerrelate", "version")).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 HistoryContainerrelateSlice) copyMatchingRows(from ...*HistoryContainerrelate) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryContainerrelateSlice) 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 HistoryContainerrelates.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 *HistoryContainerrelate: + o.copyMatchingRows(retrieved) + case []*HistoryContainerrelate: + o.copyMatchingRows(retrieved...) + case HistoryContainerrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryContainerrelate or a slice of HistoryContainerrelate + // then run the AfterUpdateHooks on the slice + _, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryContainerrelateSlice) 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 HistoryContainerrelates.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 *HistoryContainerrelate: + o.copyMatchingRows(retrieved) + case []*HistoryContainerrelate: + o.copyMatchingRows(retrieved...) + case HistoryContainerrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryContainerrelate or a slice of HistoryContainerrelate + // then run the AfterDeleteHooks on the slice + _, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryContainerrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryContainerrelateSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryContainerrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryContainerrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryContainerrelates.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryContainerrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryContainerrelates.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 *HistoryContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyContainerrelate0 *HistoryContainerrelate, organization1 *Organization) (*HistoryContainerrelate, error) { + setter := &HistoryContainerrelateSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyContainerrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryContainerrelateOrganization0: %w", err) + } + + return historyContainerrelate0, nil +} + +func (historyContainerrelate0 *HistoryContainerrelate) 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 = attachHistoryContainerrelateOrganization0(ctx, exec, 1, historyContainerrelate0, organization1) + if err != nil { + return err + } + + historyContainerrelate0.R.Organization = organization1 + + organization1.R.HistoryContainerrelates = append(organization1.R.HistoryContainerrelates, historyContainerrelate0) + + return nil +} + +func (historyContainerrelate0 *HistoryContainerrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryContainerrelateOrganization0(ctx, exec, 1, historyContainerrelate0, organization1) + if err != nil { + return err + } + + historyContainerrelate0.R.Organization = organization1 + + organization1.R.HistoryContainerrelates = append(organization1.R.HistoryContainerrelates, historyContainerrelate0) + + return nil +} + +type historyContainerrelateWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Containertype psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Inspsampleid psql.WhereNullMod[Q, string] + Mosquitoinspid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Treatmentid psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyContainerrelateWhere[Q]) AliasedAs(alias string) historyContainerrelateWhere[Q] { + return buildHistoryContainerrelateWhere[Q](buildHistoryContainerrelateColumns(alias)) +} + +func buildHistoryContainerrelateWhere[Q psql.Filterable](cols historyContainerrelateColumns) historyContainerrelateWhere[Q] { + return historyContainerrelateWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Inspsampleid: psql.WhereNull[Q, string](cols.Inspsampleid), + Mosquitoinspid: psql.WhereNull[Q, string](cols.Mosquitoinspid), + Objectid: psql.Where[Q, int32](cols.Objectid), + Treatmentid: psql.WhereNull[Q, string](cols.Treatmentid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryContainerrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyContainerrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryContainerrelates = HistoryContainerrelateSlice{o} + } + return nil + default: + return fmt.Errorf("historyContainerrelate has no relationship %q", name) + } +} + +type historyContainerrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryContainerrelatePreloader() historyContainerrelatePreloader { + return historyContainerrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryContainerrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyContainerrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryContainerrelateThenLoader[Q orm.Loadable]() historyContainerrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyContainerrelateThenLoader[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 historyContainerrelate's Organization into the .R struct +func (o *HistoryContainerrelate) 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.HistoryContainerrelates = HistoryContainerrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyContainerrelate's Organization into the .R struct +func (os HistoryContainerrelateSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyContainerrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyContainerrelateJoins[Q]) aliasedAs(alias string) historyContainerrelateJoins[Q] { + return buildHistoryContainerrelateJoins[Q](buildHistoryContainerrelateColumns(alias), j.typ) +} + +func buildHistoryContainerrelateJoins[Q dialect.Joinable](cols historyContainerrelateColumns, typ string) historyContainerrelateJoins[Q] { + return historyContainerrelateJoins[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/history_fieldscoutinglog.bob.go b/models/history_fieldscoutinglog.bob.go new file mode 100644 index 00000000..f9c28d8b --- /dev/null +++ b/models/history_fieldscoutinglog.bob.go @@ -0,0 +1,942 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyFieldscoutinglogR `db:"-" ` +} + +// HistoryFieldscoutinglogSlice is an alias for a slice of pointers to HistoryFieldscoutinglog. +// This should almost always be used instead of []*HistoryFieldscoutinglog. +type HistoryFieldscoutinglogSlice []*HistoryFieldscoutinglog + +// HistoryFieldscoutinglogs contains methods to work with the history_fieldscoutinglog table +var HistoryFieldscoutinglogs = psql.NewTablex[*HistoryFieldscoutinglog, HistoryFieldscoutinglogSlice, *HistoryFieldscoutinglogSetter]("", "history_fieldscoutinglog", buildHistoryFieldscoutinglogColumns("history_fieldscoutinglog")) + +// HistoryFieldscoutinglogsQuery is a query on the history_fieldscoutinglog table +type HistoryFieldscoutinglogsQuery = *psql.ViewQuery[*HistoryFieldscoutinglog, HistoryFieldscoutinglogSlice] + +// historyFieldscoutinglogR is where relationships are stored. +type historyFieldscoutinglogR struct { + Organization *Organization // history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey +} + +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", + ).WithParent("history_fieldscoutinglog"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + Status: psql.Quote(alias, "status"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyFieldscoutinglogColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Objectid psql.Expression + Status psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyFieldscoutinglogColumns) Alias() string { + return c.tableAlias +} + +func (historyFieldscoutinglogColumns) AliasedAs(alias string) historyFieldscoutinglogColumns { + return buildHistoryFieldscoutinglogColumns(alias) +} + +// HistoryFieldscoutinglogSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryFieldscoutinglogSetter) SetColumns() []string { + vals := make([]string, 0, 15) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Status.IsUnset() { + vals = append(vals, "status") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryFieldscoutinglogSetter) Overwrite(t *HistoryFieldscoutinglog) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Status.IsUnset() { + t.Status = s.Status.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryFieldscoutinglogs.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, 15) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[6] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Status.IsUnset() { + vals[7] = psql.Arg(s.Status.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[8] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[9] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[10] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[11] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[12] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[13] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[14] = psql.Arg(s.Version.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 15) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Status.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "status")...), + psql.Arg(s.Status), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryFieldscoutinglog retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryFieldscoutinglog(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryFieldscoutinglog, error) { + if len(cols) == 0 { + return HistoryFieldscoutinglogs.Query( + sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryFieldscoutinglogs.Query( + sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryFieldscoutinglogs.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryFieldscoutinglogExists checks the presence of a single record by primary key +func HistoryFieldscoutinglogExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryFieldscoutinglogs.Query( + sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryFieldscoutinglog is retrieved from the database +func (o *HistoryFieldscoutinglog) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryFieldscoutinglog +func (o *HistoryFieldscoutinglog) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryFieldscoutinglog) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_fieldscoutinglog", "objectid"), psql.Quote("history_fieldscoutinglog", "version")).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 HistoryFieldscoutinglog +func (o *HistoryFieldscoutinglog) Update(ctx context.Context, exec bob.Executor, s *HistoryFieldscoutinglogSetter) error { + v, err := HistoryFieldscoutinglogs.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 HistoryFieldscoutinglog record with an executor +func (o *HistoryFieldscoutinglog) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryFieldscoutinglogs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryFieldscoutinglog using the executor +func (o *HistoryFieldscoutinglog) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryFieldscoutinglogs.Query( + sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryFieldscoutinglogSlice is retrieved from the database +func (o HistoryFieldscoutinglogSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryFieldscoutinglogSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_fieldscoutinglog", "objectid"), psql.Quote("history_fieldscoutinglog", "version")).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 HistoryFieldscoutinglogSlice) copyMatchingRows(from ...*HistoryFieldscoutinglog) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryFieldscoutinglogSlice) 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 HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog: + o.copyMatchingRows(retrieved) + case []*HistoryFieldscoutinglog: + o.copyMatchingRows(retrieved...) + case HistoryFieldscoutinglogSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryFieldscoutinglog or a slice of HistoryFieldscoutinglog + // then run the AfterUpdateHooks on the slice + _, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryFieldscoutinglogSlice) 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 HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog: + o.copyMatchingRows(retrieved) + case []*HistoryFieldscoutinglog: + o.copyMatchingRows(retrieved...) + case HistoryFieldscoutinglogSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryFieldscoutinglog or a slice of HistoryFieldscoutinglog + // then run the AfterDeleteHooks on the slice + _, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryFieldscoutinglogSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryFieldscoutinglogSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryFieldscoutinglogs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryFieldscoutinglogSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryFieldscoutinglogs.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryFieldscoutinglogSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglog0 *HistoryFieldscoutinglog, organization1 *Organization) (*HistoryFieldscoutinglog, error) { + setter := &HistoryFieldscoutinglogSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyFieldscoutinglog0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryFieldscoutinglogOrganization0: %w", err) + } + + return historyFieldscoutinglog0, nil +} + +func (historyFieldscoutinglog0 *HistoryFieldscoutinglog) 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 = attachHistoryFieldscoutinglogOrganization0(ctx, exec, 1, historyFieldscoutinglog0, organization1) + if err != nil { + return err + } + + historyFieldscoutinglog0.R.Organization = organization1 + + organization1.R.HistoryFieldscoutinglogs = append(organization1.R.HistoryFieldscoutinglogs, historyFieldscoutinglog0) + + return nil +} + +func (historyFieldscoutinglog0 *HistoryFieldscoutinglog) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryFieldscoutinglogOrganization0(ctx, exec, 1, historyFieldscoutinglog0, organization1) + if err != nil { + return err + } + + historyFieldscoutinglog0.R.Organization = organization1 + + organization1.R.HistoryFieldscoutinglogs = append(organization1.R.HistoryFieldscoutinglogs, historyFieldscoutinglog0) + + return nil +} + +type historyFieldscoutinglogWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Status psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyFieldscoutinglogWhere[Q]) AliasedAs(alias string) historyFieldscoutinglogWhere[Q] { + return buildHistoryFieldscoutinglogWhere[Q](buildHistoryFieldscoutinglogColumns(alias)) +} + +func buildHistoryFieldscoutinglogWhere[Q psql.Filterable](cols historyFieldscoutinglogColumns) historyFieldscoutinglogWhere[Q] { + return historyFieldscoutinglogWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + Status: psql.WhereNull[Q, int16](cols.Status), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryFieldscoutinglog) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyFieldscoutinglog cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryFieldscoutinglogs = HistoryFieldscoutinglogSlice{o} + } + return nil + default: + return fmt.Errorf("historyFieldscoutinglog has no relationship %q", name) + } +} + +type historyFieldscoutinglogPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryFieldscoutinglogPreloader() historyFieldscoutinglogPreloader { + return historyFieldscoutinglogPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryFieldscoutinglogs, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyFieldscoutinglogThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryFieldscoutinglogThenLoader[Q orm.Loadable]() historyFieldscoutinglogThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyFieldscoutinglogThenLoader[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 historyFieldscoutinglog's Organization into the .R struct +func (o *HistoryFieldscoutinglog) 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.HistoryFieldscoutinglogs = HistoryFieldscoutinglogSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyFieldscoutinglog's Organization into the .R struct +func (os HistoryFieldscoutinglogSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryFieldscoutinglogs = append(rel.R.HistoryFieldscoutinglogs, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyFieldscoutinglogJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyFieldscoutinglogJoins[Q]) aliasedAs(alias string) historyFieldscoutinglogJoins[Q] { + return buildHistoryFieldscoutinglogJoins[Q](buildHistoryFieldscoutinglogColumns(alias), j.typ) +} + +func buildHistoryFieldscoutinglogJoins[Q dialect.Joinable](cols historyFieldscoutinglogColumns, typ string) historyFieldscoutinglogJoins[Q] { + return historyFieldscoutinglogJoins[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/history_habitatrelate.bob.go b/models/history_habitatrelate.bob.go new file mode 100644 index 00000000..061a78d0 --- /dev/null +++ b/models/history_habitatrelate.bob.go @@ -0,0 +1,967 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyHabitatrelateR `db:"-" ` +} + +// HistoryHabitatrelateSlice is an alias for a slice of pointers to HistoryHabitatrelate. +// This should almost always be used instead of []*HistoryHabitatrelate. +type HistoryHabitatrelateSlice []*HistoryHabitatrelate + +// HistoryHabitatrelates contains methods to work with the history_habitatrelate table +var HistoryHabitatrelates = psql.NewTablex[*HistoryHabitatrelate, HistoryHabitatrelateSlice, *HistoryHabitatrelateSetter]("", "history_habitatrelate", buildHistoryHabitatrelateColumns("history_habitatrelate")) + +// HistoryHabitatrelatesQuery is a query on the history_habitatrelate table +type HistoryHabitatrelatesQuery = *psql.ViewQuery[*HistoryHabitatrelate, HistoryHabitatrelateSlice] + +// historyHabitatrelateR is where relationships are stored. +type historyHabitatrelateR struct { + Organization *Organization // history_habitatrelate.history_habitatrelate_organization_id_fkey +} + +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", + ).WithParent("history_habitatrelate"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + ForeignID: psql.Quote(alias, "foreign_id"), + Globalid: psql.Quote(alias, "globalid"), + Habitattype: psql.Quote(alias, "habitattype"), + Objectid: psql.Quote(alias, "objectid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyHabitatrelateColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + ForeignID psql.Expression + Globalid psql.Expression + Habitattype psql.Expression + Objectid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyHabitatrelateColumns) Alias() string { + return c.tableAlias +} + +func (historyHabitatrelateColumns) AliasedAs(alias string) historyHabitatrelateColumns { + return buildHistoryHabitatrelateColumns(alias) +} + +// HistoryHabitatrelateSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryHabitatrelateSetter) SetColumns() []string { + vals := make([]string, 0, 16) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.ForeignID.IsUnset() { + vals = append(vals, "foreign_id") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitattype.IsUnset() { + vals = append(vals, "habitattype") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryHabitatrelateSetter) Overwrite(t *HistoryHabitatrelate) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.ForeignID.IsUnset() { + t.ForeignID = s.ForeignID.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitattype.IsUnset() { + t.Habitattype = s.Habitattype.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryHabitatrelateSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryHabitatrelates.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, 16) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.ForeignID.IsUnset() { + vals[5] = psql.Arg(s.ForeignID.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Habitattype.IsUnset() { + vals[7] = psql.Arg(s.Habitattype.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 16) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.ForeignID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "foreign_id")...), + psql.Arg(s.ForeignID), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitattype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitattype")...), + psql.Arg(s.Habitattype), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryHabitatrelate retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryHabitatrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryHabitatrelate, error) { + if len(cols) == 0 { + return HistoryHabitatrelates.Query( + sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryHabitatrelates.Query( + sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryHabitatrelates.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryHabitatrelateExists checks the presence of a single record by primary key +func HistoryHabitatrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryHabitatrelates.Query( + sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryHabitatrelate is retrieved from the database +func (o *HistoryHabitatrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryHabitatrelate +func (o *HistoryHabitatrelate) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryHabitatrelate) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_habitatrelate", "objectid"), psql.Quote("history_habitatrelate", "version")).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 HistoryHabitatrelate +func (o *HistoryHabitatrelate) Update(ctx context.Context, exec bob.Executor, s *HistoryHabitatrelateSetter) error { + v, err := HistoryHabitatrelates.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 HistoryHabitatrelate record with an executor +func (o *HistoryHabitatrelate) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryHabitatrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryHabitatrelate using the executor +func (o *HistoryHabitatrelate) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryHabitatrelates.Query( + sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryHabitatrelateSlice is retrieved from the database +func (o HistoryHabitatrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryHabitatrelateSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_habitatrelate", "objectid"), psql.Quote("history_habitatrelate", "version")).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 HistoryHabitatrelateSlice) copyMatchingRows(from ...*HistoryHabitatrelate) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryHabitatrelateSlice) 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 HistoryHabitatrelates.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 *HistoryHabitatrelate: + o.copyMatchingRows(retrieved) + case []*HistoryHabitatrelate: + o.copyMatchingRows(retrieved...) + case HistoryHabitatrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryHabitatrelate or a slice of HistoryHabitatrelate + // then run the AfterUpdateHooks on the slice + _, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryHabitatrelateSlice) 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 HistoryHabitatrelates.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 *HistoryHabitatrelate: + o.copyMatchingRows(retrieved) + case []*HistoryHabitatrelate: + o.copyMatchingRows(retrieved...) + case HistoryHabitatrelateSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryHabitatrelate or a slice of HistoryHabitatrelate + // then run the AfterDeleteHooks on the slice + _, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryHabitatrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryHabitatrelateSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryHabitatrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryHabitatrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryHabitatrelates.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryHabitatrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryHabitatrelates.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 *HistoryHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelate0 *HistoryHabitatrelate, organization1 *Organization) (*HistoryHabitatrelate, error) { + setter := &HistoryHabitatrelateSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyHabitatrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryHabitatrelateOrganization0: %w", err) + } + + return historyHabitatrelate0, nil +} + +func (historyHabitatrelate0 *HistoryHabitatrelate) 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 = attachHistoryHabitatrelateOrganization0(ctx, exec, 1, historyHabitatrelate0, organization1) + if err != nil { + return err + } + + historyHabitatrelate0.R.Organization = organization1 + + organization1.R.HistoryHabitatrelates = append(organization1.R.HistoryHabitatrelates, historyHabitatrelate0) + + return nil +} + +func (historyHabitatrelate0 *HistoryHabitatrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryHabitatrelateOrganization0(ctx, exec, 1, historyHabitatrelate0, organization1) + if err != nil { + return err + } + + historyHabitatrelate0.R.Organization = organization1 + + organization1.R.HistoryHabitatrelates = append(organization1.R.HistoryHabitatrelates, historyHabitatrelate0) + + return nil +} + +type historyHabitatrelateWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + ForeignID psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitattype psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyHabitatrelateWhere[Q]) AliasedAs(alias string) historyHabitatrelateWhere[Q] { + return buildHistoryHabitatrelateWhere[Q](buildHistoryHabitatrelateColumns(alias)) +} + +func buildHistoryHabitatrelateWhere[Q psql.Filterable](cols historyHabitatrelateColumns) historyHabitatrelateWhere[Q] { + return historyHabitatrelateWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + ForeignID: psql.WhereNull[Q, string](cols.ForeignID), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitattype: psql.WhereNull[Q, string](cols.Habitattype), + Objectid: psql.Where[Q, int32](cols.Objectid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryHabitatrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyHabitatrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryHabitatrelates = HistoryHabitatrelateSlice{o} + } + return nil + default: + return fmt.Errorf("historyHabitatrelate has no relationship %q", name) + } +} + +type historyHabitatrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryHabitatrelatePreloader() historyHabitatrelatePreloader { + return historyHabitatrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryHabitatrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyHabitatrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryHabitatrelateThenLoader[Q orm.Loadable]() historyHabitatrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyHabitatrelateThenLoader[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 historyHabitatrelate's Organization into the .R struct +func (o *HistoryHabitatrelate) 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.HistoryHabitatrelates = HistoryHabitatrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyHabitatrelate's Organization into the .R struct +func (os HistoryHabitatrelateSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyHabitatrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyHabitatrelateJoins[Q]) aliasedAs(alias string) historyHabitatrelateJoins[Q] { + return buildHistoryHabitatrelateJoins[Q](buildHistoryHabitatrelateColumns(alias), j.typ) +} + +func buildHistoryHabitatrelateJoins[Q dialect.Joinable](cols historyHabitatrelateColumns, typ string) historyHabitatrelateJoins[Q] { + return historyHabitatrelateJoins[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/history_inspectionsample.bob.go b/models/history_inspectionsample.bob.go new file mode 100644 index 00000000..8d1b2b52 --- /dev/null +++ b/models/history_inspectionsample.bob.go @@ -0,0 +1,1017 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyInspectionsampleR `db:"-" ` +} + +// HistoryInspectionsampleSlice is an alias for a slice of pointers to HistoryInspectionsample. +// This should almost always be used instead of []*HistoryInspectionsample. +type HistoryInspectionsampleSlice []*HistoryInspectionsample + +// HistoryInspectionsamples contains methods to work with the history_inspectionsample table +var HistoryInspectionsamples = psql.NewTablex[*HistoryInspectionsample, HistoryInspectionsampleSlice, *HistoryInspectionsampleSetter]("", "history_inspectionsample", buildHistoryInspectionsampleColumns("history_inspectionsample")) + +// HistoryInspectionsamplesQuery is a query on the history_inspectionsample table +type HistoryInspectionsamplesQuery = *psql.ViewQuery[*HistoryInspectionsample, HistoryInspectionsampleSlice] + +// historyInspectionsampleR is where relationships are stored. +type historyInspectionsampleR struct { + Organization *Organization // history_inspectionsample.history_inspectionsample_organization_id_fkey +} + +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", + ).WithParent("history_inspectionsample"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Idbytech: psql.Quote(alias, "idbytech"), + InspID: psql.Quote(alias, "insp_id"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Sampleid: psql.Quote(alias, "sampleid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyInspectionsampleColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Idbytech psql.Expression + InspID psql.Expression + Objectid psql.Expression + Processed psql.Expression + Sampleid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyInspectionsampleColumns) Alias() string { + return c.tableAlias +} + +func (historyInspectionsampleColumns) AliasedAs(alias string) historyInspectionsampleColumns { + return buildHistoryInspectionsampleColumns(alias) +} + +// HistoryInspectionsampleSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryInspectionsampleSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Idbytech.IsUnset() { + vals = append(vals, "idbytech") + } + if !s.InspID.IsUnset() { + vals = append(vals, "insp_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryInspectionsampleSetter) Overwrite(t *HistoryInspectionsample) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Idbytech.IsUnset() { + t.Idbytech = s.Idbytech.MustGetNull() + } + if !s.InspID.IsUnset() { + t.InspID = s.InspID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryInspectionsampleSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryInspectionsamples.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Idbytech.IsUnset() { + vals[6] = psql.Arg(s.Idbytech.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.InspID.IsUnset() { + vals[7] = psql.Arg(s.InspID.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[9] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[10] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Idbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "idbytech")...), + psql.Arg(s.Idbytech), + }}) + } + + if !s.InspID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "insp_id")...), + psql.Arg(s.InspID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryInspectionsample retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryInspectionsample(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryInspectionsample, error) { + if len(cols) == 0 { + return HistoryInspectionsamples.Query( + sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryInspectionsamples.Query( + sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryInspectionsamples.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryInspectionsampleExists checks the presence of a single record by primary key +func HistoryInspectionsampleExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryInspectionsamples.Query( + sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryInspectionsample is retrieved from the database +func (o *HistoryInspectionsample) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryInspectionsample +func (o *HistoryInspectionsample) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryInspectionsample) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_inspectionsample", "objectid"), psql.Quote("history_inspectionsample", "version")).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 HistoryInspectionsample +func (o *HistoryInspectionsample) Update(ctx context.Context, exec bob.Executor, s *HistoryInspectionsampleSetter) error { + v, err := HistoryInspectionsamples.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 HistoryInspectionsample record with an executor +func (o *HistoryInspectionsample) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryInspectionsamples.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryInspectionsample using the executor +func (o *HistoryInspectionsample) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryInspectionsamples.Query( + sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryInspectionsampleSlice is retrieved from the database +func (o HistoryInspectionsampleSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryInspectionsampleSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_inspectionsample", "objectid"), psql.Quote("history_inspectionsample", "version")).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 HistoryInspectionsampleSlice) copyMatchingRows(from ...*HistoryInspectionsample) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryInspectionsampleSlice) 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 HistoryInspectionsamples.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 *HistoryInspectionsample: + o.copyMatchingRows(retrieved) + case []*HistoryInspectionsample: + o.copyMatchingRows(retrieved...) + case HistoryInspectionsampleSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryInspectionsample or a slice of HistoryInspectionsample + // then run the AfterUpdateHooks on the slice + _, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryInspectionsampleSlice) 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 HistoryInspectionsamples.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 *HistoryInspectionsample: + o.copyMatchingRows(retrieved) + case []*HistoryInspectionsample: + o.copyMatchingRows(retrieved...) + case HistoryInspectionsampleSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryInspectionsample or a slice of HistoryInspectionsample + // then run the AfterDeleteHooks on the slice + _, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryInspectionsampleSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryInspectionsampleSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryInspectionsamples.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryInspectionsampleSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryInspectionsamples.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryInspectionsampleSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryInspectionsamples.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 *HistoryInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsample0 *HistoryInspectionsample, organization1 *Organization) (*HistoryInspectionsample, error) { + setter := &HistoryInspectionsampleSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyInspectionsample0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryInspectionsampleOrganization0: %w", err) + } + + return historyInspectionsample0, nil +} + +func (historyInspectionsample0 *HistoryInspectionsample) 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 = attachHistoryInspectionsampleOrganization0(ctx, exec, 1, historyInspectionsample0, organization1) + if err != nil { + return err + } + + historyInspectionsample0.R.Organization = organization1 + + organization1.R.HistoryInspectionsamples = append(organization1.R.HistoryInspectionsamples, historyInspectionsample0) + + return nil +} + +func (historyInspectionsample0 *HistoryInspectionsample) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryInspectionsampleOrganization0(ctx, exec, 1, historyInspectionsample0, organization1) + if err != nil { + return err + } + + historyInspectionsample0.R.Organization = organization1 + + organization1.R.HistoryInspectionsamples = append(organization1.R.HistoryInspectionsamples, historyInspectionsample0) + + return nil +} + +type historyInspectionsampleWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Idbytech psql.WhereNullMod[Q, string] + InspID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyInspectionsampleWhere[Q]) AliasedAs(alias string) historyInspectionsampleWhere[Q] { + return buildHistoryInspectionsampleWhere[Q](buildHistoryInspectionsampleColumns(alias)) +} + +func buildHistoryInspectionsampleWhere[Q psql.Filterable](cols historyInspectionsampleColumns) historyInspectionsampleWhere[Q] { + return historyInspectionsampleWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Idbytech: psql.WhereNull[Q, string](cols.Idbytech), + InspID: psql.WhereNull[Q, string](cols.InspID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryInspectionsample) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyInspectionsample cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryInspectionsamples = HistoryInspectionsampleSlice{o} + } + return nil + default: + return fmt.Errorf("historyInspectionsample has no relationship %q", name) + } +} + +type historyInspectionsamplePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryInspectionsamplePreloader() historyInspectionsamplePreloader { + return historyInspectionsamplePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryInspectionsamples, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyInspectionsampleThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryInspectionsampleThenLoader[Q orm.Loadable]() historyInspectionsampleThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyInspectionsampleThenLoader[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 historyInspectionsample's Organization into the .R struct +func (o *HistoryInspectionsample) 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.HistoryInspectionsamples = HistoryInspectionsampleSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyInspectionsample's Organization into the .R struct +func (os HistoryInspectionsampleSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryInspectionsamples = append(rel.R.HistoryInspectionsamples, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyInspectionsampleJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyInspectionsampleJoins[Q]) aliasedAs(alias string) historyInspectionsampleJoins[Q] { + return buildHistoryInspectionsampleJoins[Q](buildHistoryInspectionsampleColumns(alias), j.typ) +} + +func buildHistoryInspectionsampleJoins[Q dialect.Joinable](cols historyInspectionsampleColumns, typ string) historyInspectionsampleJoins[Q] { + return historyInspectionsampleJoins[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/history_inspectionsampledetail.bob.go b/models/history_inspectionsampledetail.bob.go new file mode 100644 index 00000000..0e294131 --- /dev/null +++ b/models/history_inspectionsampledetail.bob.go @@ -0,0 +1,1292 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyInspectionsampledetailR `db:"-" ` +} + +// HistoryInspectionsampledetailSlice is an alias for a slice of pointers to HistoryInspectionsampledetail. +// This should almost always be used instead of []*HistoryInspectionsampledetail. +type HistoryInspectionsampledetailSlice []*HistoryInspectionsampledetail + +// HistoryInspectionsampledetails contains methods to work with the history_inspectionsampledetail table +var HistoryInspectionsampledetails = psql.NewTablex[*HistoryInspectionsampledetail, HistoryInspectionsampledetailSlice, *HistoryInspectionsampledetailSetter]("", "history_inspectionsampledetail", buildHistoryInspectionsampledetailColumns("history_inspectionsampledetail")) + +// HistoryInspectionsampledetailsQuery is a query on the history_inspectionsampledetail table +type HistoryInspectionsampledetailsQuery = *psql.ViewQuery[*HistoryInspectionsampledetail, HistoryInspectionsampledetailSlice] + +// historyInspectionsampledetailR is where relationships are stored. +type historyInspectionsampledetailR struct { + Organization *Organization // history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey +} + +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", + ).WithParent("history_inspectionsampledetail"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fadultact: psql.Quote(alias, "fadultact"), + Fdomstage: psql.Quote(alias, "fdomstage"), + Feggcount: psql.Quote(alias, "feggcount"), + Fieldspecies: psql.Quote(alias, "fieldspecies"), + Flarvcount: psql.Quote(alias, "flarvcount"), + Flstages: psql.Quote(alias, "flstages"), + Fpupcount: psql.Quote(alias, "fpupcount"), + Globalid: psql.Quote(alias, "globalid"), + InspsampleID: psql.Quote(alias, "inspsample_id"), + Labspecies: psql.Quote(alias, "labspecies"), + Ldomstage: psql.Quote(alias, "ldomstage"), + Leggcount: psql.Quote(alias, "leggcount"), + Llarvcount: psql.Quote(alias, "llarvcount"), + Lpupcount: psql.Quote(alias, "lpupcount"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyInspectionsampledetailColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fadultact psql.Expression + Fdomstage psql.Expression + Feggcount psql.Expression + Fieldspecies psql.Expression + Flarvcount psql.Expression + Flstages psql.Expression + Fpupcount psql.Expression + Globalid psql.Expression + InspsampleID psql.Expression + Labspecies psql.Expression + Ldomstage psql.Expression + Leggcount psql.Expression + Llarvcount psql.Expression + Lpupcount psql.Expression + Objectid psql.Expression + Processed psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyInspectionsampledetailColumns) Alias() string { + return c.tableAlias +} + +func (historyInspectionsampledetailColumns) AliasedAs(alias string) historyInspectionsampledetailColumns { + return buildHistoryInspectionsampledetailColumns(alias) +} + +// HistoryInspectionsampledetailSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryInspectionsampledetailSetter) SetColumns() []string { + vals := make([]string, 0, 29) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fadultact.IsUnset() { + vals = append(vals, "fadultact") + } + if !s.Fdomstage.IsUnset() { + vals = append(vals, "fdomstage") + } + if !s.Feggcount.IsUnset() { + vals = append(vals, "feggcount") + } + if !s.Fieldspecies.IsUnset() { + vals = append(vals, "fieldspecies") + } + if !s.Flarvcount.IsUnset() { + vals = append(vals, "flarvcount") + } + if !s.Flstages.IsUnset() { + vals = append(vals, "flstages") + } + if !s.Fpupcount.IsUnset() { + vals = append(vals, "fpupcount") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.InspsampleID.IsUnset() { + vals = append(vals, "inspsample_id") + } + if !s.Labspecies.IsUnset() { + vals = append(vals, "labspecies") + } + if !s.Ldomstage.IsUnset() { + vals = append(vals, "ldomstage") + } + if !s.Leggcount.IsUnset() { + vals = append(vals, "leggcount") + } + if !s.Llarvcount.IsUnset() { + vals = append(vals, "llarvcount") + } + if !s.Lpupcount.IsUnset() { + vals = append(vals, "lpupcount") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryInspectionsampledetailSetter) Overwrite(t *HistoryInspectionsampledetail) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fadultact.IsUnset() { + t.Fadultact = s.Fadultact.MustGetNull() + } + if !s.Fdomstage.IsUnset() { + t.Fdomstage = s.Fdomstage.MustGetNull() + } + if !s.Feggcount.IsUnset() { + t.Feggcount = s.Feggcount.MustGetNull() + } + if !s.Fieldspecies.IsUnset() { + t.Fieldspecies = s.Fieldspecies.MustGetNull() + } + if !s.Flarvcount.IsUnset() { + t.Flarvcount = s.Flarvcount.MustGetNull() + } + if !s.Flstages.IsUnset() { + t.Flstages = s.Flstages.MustGetNull() + } + if !s.Fpupcount.IsUnset() { + t.Fpupcount = s.Fpupcount.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.InspsampleID.IsUnset() { + t.InspsampleID = s.InspsampleID.MustGetNull() + } + if !s.Labspecies.IsUnset() { + t.Labspecies = s.Labspecies.MustGetNull() + } + if !s.Ldomstage.IsUnset() { + t.Ldomstage = s.Ldomstage.MustGetNull() + } + if !s.Leggcount.IsUnset() { + t.Leggcount = s.Leggcount.MustGetNull() + } + if !s.Llarvcount.IsUnset() { + t.Llarvcount = s.Llarvcount.MustGetNull() + } + if !s.Lpupcount.IsUnset() { + t.Lpupcount = s.Lpupcount.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryInspectionsampledetails.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, 29) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Fadultact.IsUnset() { + vals[6] = psql.Arg(s.Fadultact.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Fdomstage.IsUnset() { + vals[7] = psql.Arg(s.Fdomstage.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Feggcount.IsUnset() { + vals[8] = psql.Arg(s.Feggcount.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Fieldspecies.IsUnset() { + vals[9] = psql.Arg(s.Fieldspecies.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Flarvcount.IsUnset() { + vals[10] = psql.Arg(s.Flarvcount.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Flstages.IsUnset() { + vals[11] = psql.Arg(s.Flstages.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Fpupcount.IsUnset() { + vals[12] = psql.Arg(s.Fpupcount.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[13] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.InspsampleID.IsUnset() { + vals[14] = psql.Arg(s.InspsampleID.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Labspecies.IsUnset() { + vals[15] = psql.Arg(s.Labspecies.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Ldomstage.IsUnset() { + vals[16] = psql.Arg(s.Ldomstage.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Leggcount.IsUnset() { + vals[17] = psql.Arg(s.Leggcount.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Llarvcount.IsUnset() { + vals[18] = psql.Arg(s.Llarvcount.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lpupcount.IsUnset() { + vals[19] = psql.Arg(s.Lpupcount.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[20] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[21] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 29) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fadultact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fadultact")...), + psql.Arg(s.Fadultact), + }}) + } + + if !s.Fdomstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fdomstage")...), + psql.Arg(s.Fdomstage), + }}) + } + + if !s.Feggcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "feggcount")...), + psql.Arg(s.Feggcount), + }}) + } + + if !s.Fieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldspecies")...), + psql.Arg(s.Fieldspecies), + }}) + } + + if !s.Flarvcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flarvcount")...), + psql.Arg(s.Flarvcount), + }}) + } + + if !s.Flstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flstages")...), + psql.Arg(s.Flstages), + }}) + } + + if !s.Fpupcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fpupcount")...), + psql.Arg(s.Fpupcount), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.InspsampleID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "inspsample_id")...), + psql.Arg(s.InspsampleID), + }}) + } + + if !s.Labspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "labspecies")...), + psql.Arg(s.Labspecies), + }}) + } + + if !s.Ldomstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ldomstage")...), + psql.Arg(s.Ldomstage), + }}) + } + + if !s.Leggcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "leggcount")...), + psql.Arg(s.Leggcount), + }}) + } + + if !s.Llarvcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "llarvcount")...), + psql.Arg(s.Llarvcount), + }}) + } + + if !s.Lpupcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lpupcount")...), + psql.Arg(s.Lpupcount), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryInspectionsampledetail retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryInspectionsampledetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryInspectionsampledetail, error) { + if len(cols) == 0 { + return HistoryInspectionsampledetails.Query( + sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryInspectionsampledetails.Query( + sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryInspectionsampledetails.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryInspectionsampledetailExists checks the presence of a single record by primary key +func HistoryInspectionsampledetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryInspectionsampledetails.Query( + sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryInspectionsampledetail is retrieved from the database +func (o *HistoryInspectionsampledetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryInspectionsampledetail +func (o *HistoryInspectionsampledetail) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryInspectionsampledetail) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_inspectionsampledetail", "objectid"), psql.Quote("history_inspectionsampledetail", "version")).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 HistoryInspectionsampledetail +func (o *HistoryInspectionsampledetail) Update(ctx context.Context, exec bob.Executor, s *HistoryInspectionsampledetailSetter) error { + v, err := HistoryInspectionsampledetails.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 HistoryInspectionsampledetail record with an executor +func (o *HistoryInspectionsampledetail) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryInspectionsampledetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryInspectionsampledetail using the executor +func (o *HistoryInspectionsampledetail) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryInspectionsampledetails.Query( + sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryInspectionsampledetailSlice is retrieved from the database +func (o HistoryInspectionsampledetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryInspectionsampledetailSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_inspectionsampledetail", "objectid"), psql.Quote("history_inspectionsampledetail", "version")).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 HistoryInspectionsampledetailSlice) copyMatchingRows(from ...*HistoryInspectionsampledetail) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryInspectionsampledetailSlice) 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 HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail: + o.copyMatchingRows(retrieved) + case []*HistoryInspectionsampledetail: + o.copyMatchingRows(retrieved...) + case HistoryInspectionsampledetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryInspectionsampledetail or a slice of HistoryInspectionsampledetail + // then run the AfterUpdateHooks on the slice + _, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryInspectionsampledetailSlice) 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 HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail: + o.copyMatchingRows(retrieved) + case []*HistoryInspectionsampledetail: + o.copyMatchingRows(retrieved...) + case HistoryInspectionsampledetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryInspectionsampledetail or a slice of HistoryInspectionsampledetail + // then run the AfterDeleteHooks on the slice + _, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryInspectionsampledetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryInspectionsampledetailSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryInspectionsampledetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryInspectionsampledetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryInspectionsampledetails.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryInspectionsampledetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryInspectionsampledetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetail0 *HistoryInspectionsampledetail, organization1 *Organization) (*HistoryInspectionsampledetail, error) { + setter := &HistoryInspectionsampledetailSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyInspectionsampledetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryInspectionsampledetailOrganization0: %w", err) + } + + return historyInspectionsampledetail0, nil +} + +func (historyInspectionsampledetail0 *HistoryInspectionsampledetail) 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 = attachHistoryInspectionsampledetailOrganization0(ctx, exec, 1, historyInspectionsampledetail0, organization1) + if err != nil { + return err + } + + historyInspectionsampledetail0.R.Organization = organization1 + + organization1.R.HistoryInspectionsampledetails = append(organization1.R.HistoryInspectionsampledetails, historyInspectionsampledetail0) + + return nil +} + +func (historyInspectionsampledetail0 *HistoryInspectionsampledetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryInspectionsampledetailOrganization0(ctx, exec, 1, historyInspectionsampledetail0, organization1) + if err != nil { + return err + } + + historyInspectionsampledetail0.R.Organization = organization1 + + organization1.R.HistoryInspectionsampledetails = append(organization1.R.HistoryInspectionsampledetails, historyInspectionsampledetail0) + + return nil +} + +type historyInspectionsampledetailWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fadultact psql.WhereNullMod[Q, string] + Fdomstage psql.WhereNullMod[Q, string] + Feggcount psql.WhereNullMod[Q, int16] + Fieldspecies psql.WhereNullMod[Q, string] + Flarvcount psql.WhereNullMod[Q, int16] + Flstages psql.WhereNullMod[Q, string] + Fpupcount psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + InspsampleID psql.WhereNullMod[Q, string] + Labspecies psql.WhereNullMod[Q, string] + Ldomstage psql.WhereNullMod[Q, string] + Leggcount psql.WhereNullMod[Q, int16] + Llarvcount psql.WhereNullMod[Q, int16] + Lpupcount psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyInspectionsampledetailWhere[Q]) AliasedAs(alias string) historyInspectionsampledetailWhere[Q] { + return buildHistoryInspectionsampledetailWhere[Q](buildHistoryInspectionsampledetailColumns(alias)) +} + +func buildHistoryInspectionsampledetailWhere[Q psql.Filterable](cols historyInspectionsampledetailColumns) historyInspectionsampledetailWhere[Q] { + return historyInspectionsampledetailWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fadultact: psql.WhereNull[Q, string](cols.Fadultact), + Fdomstage: psql.WhereNull[Q, string](cols.Fdomstage), + Feggcount: psql.WhereNull[Q, int16](cols.Feggcount), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), + Flarvcount: psql.WhereNull[Q, int16](cols.Flarvcount), + Flstages: psql.WhereNull[Q, string](cols.Flstages), + Fpupcount: psql.WhereNull[Q, int16](cols.Fpupcount), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + InspsampleID: psql.WhereNull[Q, string](cols.InspsampleID), + Labspecies: psql.WhereNull[Q, string](cols.Labspecies), + Ldomstage: psql.WhereNull[Q, string](cols.Ldomstage), + Leggcount: psql.WhereNull[Q, int16](cols.Leggcount), + Llarvcount: psql.WhereNull[Q, int16](cols.Llarvcount), + Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryInspectionsampledetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyInspectionsampledetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryInspectionsampledetails = HistoryInspectionsampledetailSlice{o} + } + return nil + default: + return fmt.Errorf("historyInspectionsampledetail has no relationship %q", name) + } +} + +type historyInspectionsampledetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryInspectionsampledetailPreloader() historyInspectionsampledetailPreloader { + return historyInspectionsampledetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryInspectionsampledetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyInspectionsampledetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryInspectionsampledetailThenLoader[Q orm.Loadable]() historyInspectionsampledetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyInspectionsampledetailThenLoader[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 historyInspectionsampledetail's Organization into the .R struct +func (o *HistoryInspectionsampledetail) 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.HistoryInspectionsampledetails = HistoryInspectionsampledetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyInspectionsampledetail's Organization into the .R struct +func (os HistoryInspectionsampledetailSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryInspectionsampledetails = append(rel.R.HistoryInspectionsampledetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyInspectionsampledetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyInspectionsampledetailJoins[Q]) aliasedAs(alias string) historyInspectionsampledetailJoins[Q] { + return buildHistoryInspectionsampledetailJoins[Q](buildHistoryInspectionsampledetailColumns(alias), j.typ) +} + +func buildHistoryInspectionsampledetailJoins[Q dialect.Joinable](cols historyInspectionsampledetailColumns, typ string) historyInspectionsampledetailJoins[Q] { + return historyInspectionsampledetailJoins[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/history_linelocation.bob.go b/models/history_linelocation.bob.go new file mode 100644 index 00000000..e9bb8379 --- /dev/null +++ b/models/history_linelocation.bob.go @@ -0,0 +1,1867 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyLinelocationR `db:"-" ` +} + +// HistoryLinelocationSlice is an alias for a slice of pointers to HistoryLinelocation. +// This should almost always be used instead of []*HistoryLinelocation. +type HistoryLinelocationSlice []*HistoryLinelocation + +// HistoryLinelocations contains methods to work with the history_linelocation table +var HistoryLinelocations = psql.NewTablex[*HistoryLinelocation, HistoryLinelocationSlice, *HistoryLinelocationSetter]("", "history_linelocation", buildHistoryLinelocationColumns("history_linelocation")) + +// HistoryLinelocationsQuery is a query on the history_linelocation table +type HistoryLinelocationsQuery = *psql.ViewQuery[*HistoryLinelocation, HistoryLinelocationSlice] + +// historyLinelocationR is where relationships are stored. +type historyLinelocationR struct { + Organization *Organization // history_linelocation.history_linelocation_organization_id_fkey +} + +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", + ).WithParent("history_linelocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Acres: psql.Quote(alias, "acres"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Hectares: psql.Quote(alias, "hectares"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + LengthFT: psql.Quote(alias, "length_ft"), + LengthMeters: psql.Quote(alias, "length_meters"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + ShapeLength: psql.Quote(alias, "shape__length"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + WidthFT: psql.Quote(alias, "width_ft"), + WidthMeters: psql.Quote(alias, "width_meters"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyLinelocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Acres psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Hectares psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + LengthFT psql.Expression + LengthMeters psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + ShapeLength psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + WidthFT psql.Expression + WidthMeters psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyLinelocationColumns) Alias() string { + return c.tableAlias +} + +func (historyLinelocationColumns) AliasedAs(alias string) historyLinelocationColumns { + return buildHistoryLinelocationColumns(alias) +} + +// HistoryLinelocationSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryLinelocationSetter) SetColumns() []string { + vals := make([]string, 0, 52) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.LengthFT.IsUnset() { + vals = append(vals, "length_ft") + } + if !s.LengthMeters.IsUnset() { + vals = append(vals, "length_meters") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.WidthFT.IsUnset() { + vals = append(vals, "width_ft") + } + if !s.WidthMeters.IsUnset() { + vals = append(vals, "width_meters") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryLinelocationSetter) Overwrite(t *HistoryLinelocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.LengthFT.IsUnset() { + t.LengthFT = s.LengthFT.MustGetNull() + } + if !s.LengthMeters.IsUnset() { + t.LengthMeters = s.LengthMeters.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.WidthFT.IsUnset() { + t.WidthFT = s.WidthFT.MustGetNull() + } + if !s.WidthMeters.IsUnset() { + t.WidthMeters = s.WidthMeters.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryLinelocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryLinelocations.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, 52) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[2] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[3] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[7] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[8] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[9] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[10] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[13] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[14] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[15] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[23] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[24] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[25] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[28] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[29] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.LengthFT.IsUnset() { + vals[30] = psql.Arg(s.LengthFT.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.LengthMeters.IsUnset() { + vals[31] = psql.Arg(s.LengthMeters.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[32] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[33] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[34] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[35] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[36] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[37] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[39] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.WidthFT.IsUnset() { + vals[41] = psql.Arg(s.WidthFT.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.WidthMeters.IsUnset() { + vals[42] = psql.Arg(s.WidthMeters.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[43] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[44] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[45] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[46] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[47] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[48] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[49] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[50] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[51] = psql.Arg(s.Version.MustGet()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryLinelocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 52) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.LengthFT.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "length_ft")...), + psql.Arg(s.LengthFT), + }}) + } + + if !s.LengthMeters.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "length_meters")...), + psql.Arg(s.LengthMeters), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.WidthFT.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "width_ft")...), + psql.Arg(s.WidthFT), + }}) + } + + if !s.WidthMeters.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "width_meters")...), + psql.Arg(s.WidthMeters), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryLinelocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryLinelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryLinelocation, error) { + if len(cols) == 0 { + return HistoryLinelocations.Query( + sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryLinelocations.Query( + sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryLinelocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryLinelocationExists checks the presence of a single record by primary key +func HistoryLinelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryLinelocations.Query( + sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryLinelocation is retrieved from the database +func (o *HistoryLinelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryLinelocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryLinelocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryLinelocation +func (o *HistoryLinelocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryLinelocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_linelocation", "objectid"), psql.Quote("history_linelocation", "version")).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 HistoryLinelocation +func (o *HistoryLinelocation) Update(ctx context.Context, exec bob.Executor, s *HistoryLinelocationSetter) error { + v, err := HistoryLinelocations.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 HistoryLinelocation record with an executor +func (o *HistoryLinelocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryLinelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryLinelocation using the executor +func (o *HistoryLinelocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryLinelocations.Query( + sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryLinelocationSlice is retrieved from the database +func (o HistoryLinelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryLinelocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryLinelocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryLinelocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_linelocation", "objectid"), psql.Quote("history_linelocation", "version")).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 HistoryLinelocationSlice) copyMatchingRows(from ...*HistoryLinelocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryLinelocationSlice) 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 HistoryLinelocations.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 *HistoryLinelocation: + o.copyMatchingRows(retrieved) + case []*HistoryLinelocation: + o.copyMatchingRows(retrieved...) + case HistoryLinelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryLinelocation or a slice of HistoryLinelocation + // then run the AfterUpdateHooks on the slice + _, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryLinelocationSlice) 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 HistoryLinelocations.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 *HistoryLinelocation: + o.copyMatchingRows(retrieved) + case []*HistoryLinelocation: + o.copyMatchingRows(retrieved...) + case HistoryLinelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryLinelocation or a slice of HistoryLinelocation + // then run the AfterDeleteHooks on the slice + _, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryLinelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryLinelocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryLinelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryLinelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryLinelocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryLinelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryLinelocations.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 *HistoryLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyLinelocation0 *HistoryLinelocation, organization1 *Organization) (*HistoryLinelocation, error) { + setter := &HistoryLinelocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyLinelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryLinelocationOrganization0: %w", err) + } + + return historyLinelocation0, nil +} + +func (historyLinelocation0 *HistoryLinelocation) 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 = attachHistoryLinelocationOrganization0(ctx, exec, 1, historyLinelocation0, organization1) + if err != nil { + return err + } + + historyLinelocation0.R.Organization = organization1 + + organization1.R.HistoryLinelocations = append(organization1.R.HistoryLinelocations, historyLinelocation0) + + return nil +} + +func (historyLinelocation0 *HistoryLinelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryLinelocationOrganization0(ctx, exec, 1, historyLinelocation0, organization1) + if err != nil { + return err + } + + historyLinelocation0.R.Organization = organization1 + + organization1.R.HistoryLinelocations = append(organization1.R.HistoryLinelocations, historyLinelocation0) + + return nil +} + +type historyLinelocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Acres psql.WhereNullMod[Q, float64] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + LengthFT psql.WhereNullMod[Q, float64] + LengthMeters psql.WhereNullMod[Q, float64] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + ShapeLength psql.WhereNullMod[Q, float64] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + WidthFT psql.WhereNullMod[Q, float64] + WidthMeters psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyLinelocationWhere[Q]) AliasedAs(alias string) historyLinelocationWhere[Q] { + return buildHistoryLinelocationWhere[Q](buildHistoryLinelocationColumns(alias)) +} + +func buildHistoryLinelocationWhere[Q psql.Filterable](cols historyLinelocationColumns) historyLinelocationWhere[Q] { + return historyLinelocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + LengthFT: psql.WhereNull[Q, float64](cols.LengthFT), + LengthMeters: psql.WhereNull[Q, float64](cols.LengthMeters), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + WidthFT: psql.WhereNull[Q, float64](cols.WidthFT), + WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryLinelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyLinelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryLinelocations = HistoryLinelocationSlice{o} + } + return nil + default: + return fmt.Errorf("historyLinelocation has no relationship %q", name) + } +} + +type historyLinelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryLinelocationPreloader() historyLinelocationPreloader { + return historyLinelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryLinelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyLinelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryLinelocationThenLoader[Q orm.Loadable]() historyLinelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyLinelocationThenLoader[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 historyLinelocation's Organization into the .R struct +func (o *HistoryLinelocation) 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.HistoryLinelocations = HistoryLinelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyLinelocation's Organization into the .R struct +func (os HistoryLinelocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryLinelocations = append(rel.R.HistoryLinelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyLinelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyLinelocationJoins[Q]) aliasedAs(alias string) historyLinelocationJoins[Q] { + return buildHistoryLinelocationJoins[Q](buildHistoryLinelocationColumns(alias), j.typ) +} + +func buildHistoryLinelocationJoins[Q dialect.Joinable](cols historyLinelocationColumns, typ string) historyLinelocationJoins[Q] { + return historyLinelocationJoins[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/history_locationtracking.bob.go b/models/history_locationtracking.bob.go new file mode 100644 index 00000000..4c22e097 --- /dev/null +++ b/models/history_locationtracking.bob.go @@ -0,0 +1,967 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyLocationtrackingR `db:"-" ` +} + +// HistoryLocationtrackingSlice is an alias for a slice of pointers to HistoryLocationtracking. +// This should almost always be used instead of []*HistoryLocationtracking. +type HistoryLocationtrackingSlice []*HistoryLocationtracking + +// HistoryLocationtrackings contains methods to work with the history_locationtracking table +var HistoryLocationtrackings = psql.NewTablex[*HistoryLocationtracking, HistoryLocationtrackingSlice, *HistoryLocationtrackingSetter]("", "history_locationtracking", buildHistoryLocationtrackingColumns("history_locationtracking")) + +// HistoryLocationtrackingsQuery is a query on the history_locationtracking table +type HistoryLocationtrackingsQuery = *psql.ViewQuery[*HistoryLocationtracking, HistoryLocationtrackingSlice] + +// historyLocationtrackingR is where relationships are stored. +type historyLocationtrackingR struct { + Organization *Organization // history_locationtracking.history_locationtracking_organization_id_fkey +} + +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", + ).WithParent("history_locationtracking"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accuracy: psql.Quote(alias, "accuracy"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyLocationtrackingColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accuracy psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Objectid psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyLocationtrackingColumns) Alias() string { + return c.tableAlias +} + +func (historyLocationtrackingColumns) AliasedAs(alias string) historyLocationtrackingColumns { + return buildHistoryLocationtrackingColumns(alias) +} + +// HistoryLocationtrackingSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryLocationtrackingSetter) SetColumns() []string { + vals := make([]string, 0, 16) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accuracy.IsUnset() { + vals = append(vals, "accuracy") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryLocationtrackingSetter) Overwrite(t *HistoryLocationtracking) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accuracy.IsUnset() { + t.Accuracy = s.Accuracy.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryLocationtrackingSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryLocationtrackings.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, 16) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accuracy.IsUnset() { + vals[1] = psql.Arg(s.Accuracy.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[6] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[7] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 16) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accuracy.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accuracy")...), + psql.Arg(s.Accuracy), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryLocationtracking retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryLocationtracking(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryLocationtracking, error) { + if len(cols) == 0 { + return HistoryLocationtrackings.Query( + sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryLocationtrackings.Query( + sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryLocationtrackings.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryLocationtrackingExists checks the presence of a single record by primary key +func HistoryLocationtrackingExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryLocationtrackings.Query( + sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryLocationtracking is retrieved from the database +func (o *HistoryLocationtracking) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryLocationtracking +func (o *HistoryLocationtracking) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryLocationtracking) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_locationtracking", "objectid"), psql.Quote("history_locationtracking", "version")).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 HistoryLocationtracking +func (o *HistoryLocationtracking) Update(ctx context.Context, exec bob.Executor, s *HistoryLocationtrackingSetter) error { + v, err := HistoryLocationtrackings.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 HistoryLocationtracking record with an executor +func (o *HistoryLocationtracking) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryLocationtrackings.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryLocationtracking using the executor +func (o *HistoryLocationtracking) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryLocationtrackings.Query( + sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryLocationtrackingSlice is retrieved from the database +func (o HistoryLocationtrackingSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryLocationtrackingSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_locationtracking", "objectid"), psql.Quote("history_locationtracking", "version")).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 HistoryLocationtrackingSlice) copyMatchingRows(from ...*HistoryLocationtracking) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryLocationtrackingSlice) 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 HistoryLocationtrackings.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 *HistoryLocationtracking: + o.copyMatchingRows(retrieved) + case []*HistoryLocationtracking: + o.copyMatchingRows(retrieved...) + case HistoryLocationtrackingSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryLocationtracking or a slice of HistoryLocationtracking + // then run the AfterUpdateHooks on the slice + _, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryLocationtrackingSlice) 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 HistoryLocationtrackings.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 *HistoryLocationtracking: + o.copyMatchingRows(retrieved) + case []*HistoryLocationtracking: + o.copyMatchingRows(retrieved...) + case HistoryLocationtrackingSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryLocationtracking or a slice of HistoryLocationtracking + // then run the AfterDeleteHooks on the slice + _, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryLocationtrackingSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryLocationtrackingSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryLocationtrackings.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryLocationtrackingSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryLocationtrackings.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryLocationtrackingSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryLocationtrackings.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 *HistoryLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, historyLocationtracking0 *HistoryLocationtracking, organization1 *Organization) (*HistoryLocationtracking, error) { + setter := &HistoryLocationtrackingSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyLocationtracking0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryLocationtrackingOrganization0: %w", err) + } + + return historyLocationtracking0, nil +} + +func (historyLocationtracking0 *HistoryLocationtracking) 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 = attachHistoryLocationtrackingOrganization0(ctx, exec, 1, historyLocationtracking0, organization1) + if err != nil { + return err + } + + historyLocationtracking0.R.Organization = organization1 + + organization1.R.HistoryLocationtrackings = append(organization1.R.HistoryLocationtrackings, historyLocationtracking0) + + return nil +} + +func (historyLocationtracking0 *HistoryLocationtracking) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryLocationtrackingOrganization0(ctx, exec, 1, historyLocationtracking0, organization1) + if err != nil { + return err + } + + historyLocationtracking0.R.Organization = organization1 + + organization1.R.HistoryLocationtrackings = append(organization1.R.HistoryLocationtrackings, historyLocationtracking0) + + return nil +} + +type historyLocationtrackingWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accuracy psql.WhereNullMod[Q, float64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyLocationtrackingWhere[Q]) AliasedAs(alias string) historyLocationtrackingWhere[Q] { + return buildHistoryLocationtrackingWhere[Q](buildHistoryLocationtrackingColumns(alias)) +} + +func buildHistoryLocationtrackingWhere[Q psql.Filterable](cols historyLocationtrackingColumns) historyLocationtrackingWhere[Q] { + return historyLocationtrackingWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryLocationtracking) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyLocationtracking cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryLocationtrackings = HistoryLocationtrackingSlice{o} + } + return nil + default: + return fmt.Errorf("historyLocationtracking has no relationship %q", name) + } +} + +type historyLocationtrackingPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryLocationtrackingPreloader() historyLocationtrackingPreloader { + return historyLocationtrackingPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryLocationtrackings, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyLocationtrackingThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryLocationtrackingThenLoader[Q orm.Loadable]() historyLocationtrackingThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyLocationtrackingThenLoader[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 historyLocationtracking's Organization into the .R struct +func (o *HistoryLocationtracking) 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.HistoryLocationtrackings = HistoryLocationtrackingSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyLocationtracking's Organization into the .R struct +func (os HistoryLocationtrackingSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryLocationtrackings = append(rel.R.HistoryLocationtrackings, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyLocationtrackingJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyLocationtrackingJoins[Q]) aliasedAs(alias string) historyLocationtrackingJoins[Q] { + return buildHistoryLocationtrackingJoins[Q](buildHistoryLocationtrackingColumns(alias), j.typ) +} + +func buildHistoryLocationtrackingJoins[Q dialect.Joinable](cols historyLocationtrackingColumns, typ string) historyLocationtrackingJoins[Q] { + return historyLocationtrackingJoins[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/history_mosquitoinspection.bob.go b/models/history_mosquitoinspection.bob.go new file mode 100644 index 00000000..480c004b --- /dev/null +++ b/models/history_mosquitoinspection.bob.go @@ -0,0 +1,2092 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyMosquitoinspectionR `db:"-" ` +} + +// HistoryMosquitoinspectionSlice is an alias for a slice of pointers to HistoryMosquitoinspection. +// This should almost always be used instead of []*HistoryMosquitoinspection. +type HistoryMosquitoinspectionSlice []*HistoryMosquitoinspection + +// HistoryMosquitoinspections contains methods to work with the history_mosquitoinspection table +var HistoryMosquitoinspections = psql.NewTablex[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice, *HistoryMosquitoinspectionSetter]("", "history_mosquitoinspection", buildHistoryMosquitoinspectionColumns("history_mosquitoinspection")) + +// HistoryMosquitoinspectionsQuery is a query on the history_mosquitoinspection table +type HistoryMosquitoinspectionsQuery = *psql.ViewQuery[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice] + +// historyMosquitoinspectionR is where relationships are stored. +type historyMosquitoinspectionR struct { + Organization *Organization // history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey +} + +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", + ).WithParent("history_mosquitoinspection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Actiontaken: psql.Quote(alias, "actiontaken"), + Activity: psql.Quote(alias, "activity"), + Adultact: psql.Quote(alias, "adultact"), + Avetemp: psql.Quote(alias, "avetemp"), + Avglarvae: psql.Quote(alias, "avglarvae"), + Avgpupae: psql.Quote(alias, "avgpupae"), + Breeding: psql.Quote(alias, "breeding"), + Cbcount: psql.Quote(alias, "cbcount"), + Comments: psql.Quote(alias, "comments"), + Containercount: psql.Quote(alias, "containercount"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Domstage: psql.Quote(alias, "domstage"), + Eggs: psql.Quote(alias, "eggs"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldspecies: psql.Quote(alias, "fieldspecies"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvaepresent: psql.Quote(alias, "larvaepresent"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Lstages: psql.Quote(alias, "lstages"), + Numdips: psql.Quote(alias, "numdips"), + Objectid: psql.Quote(alias, "objectid"), + Personalcontact: psql.Quote(alias, "personalcontact"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Posdips: psql.Quote(alias, "posdips"), + Positivecontainercount: psql.Quote(alias, "positivecontainercount"), + Pupaepresent: psql.Quote(alias, "pupaepresent"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sdid: psql.Quote(alias, "sdid"), + Sitecond: psql.Quote(alias, "sitecond"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Tirecount: psql.Quote(alias, "tirecount"), + Totlarvae: psql.Quote(alias, "totlarvae"), + Totpupae: psql.Quote(alias, "totpupae"), + Visualmonitoring: psql.Quote(alias, "visualmonitoring"), + Vmcomments: psql.Quote(alias, "vmcomments"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Adminaction: psql.Quote(alias, "adminaction"), + Ptaid: psql.Quote(alias, "ptaid"), + Version: psql.Quote(alias, "version"), + } +} + +type historyMosquitoinspectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Actiontaken psql.Expression + Activity psql.Expression + Adultact psql.Expression + Avetemp psql.Expression + Avglarvae psql.Expression + Avgpupae psql.Expression + Breeding psql.Expression + Cbcount psql.Expression + Comments psql.Expression + Containercount psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Domstage psql.Expression + Eggs psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldspecies psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Jurisdiction psql.Expression + Larvaepresent psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Lstages psql.Expression + Numdips psql.Expression + Objectid psql.Expression + Personalcontact psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Posdips psql.Expression + Positivecontainercount psql.Expression + Pupaepresent psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sdid psql.Expression + Sitecond psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Tirecount psql.Expression + Totlarvae psql.Expression + Totpupae psql.Expression + Visualmonitoring psql.Expression + Vmcomments psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Adminaction psql.Expression + Ptaid psql.Expression + Version psql.Expression +} + +func (c historyMosquitoinspectionColumns) Alias() string { + return c.tableAlias +} + +func (historyMosquitoinspectionColumns) AliasedAs(alias string) historyMosquitoinspectionColumns { + return buildHistoryMosquitoinspectionColumns(alias) +} + +// HistoryMosquitoinspectionSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryMosquitoinspectionSetter) SetColumns() []string { + vals := make([]string, 0, 61) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Actiontaken.IsUnset() { + vals = append(vals, "actiontaken") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Adultact.IsUnset() { + vals = append(vals, "adultact") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Avglarvae.IsUnset() { + vals = append(vals, "avglarvae") + } + if !s.Avgpupae.IsUnset() { + vals = append(vals, "avgpupae") + } + if !s.Breeding.IsUnset() { + vals = append(vals, "breeding") + } + if !s.Cbcount.IsUnset() { + vals = append(vals, "cbcount") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Containercount.IsUnset() { + vals = append(vals, "containercount") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Domstage.IsUnset() { + vals = append(vals, "domstage") + } + if !s.Eggs.IsUnset() { + vals = append(vals, "eggs") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldspecies.IsUnset() { + vals = append(vals, "fieldspecies") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvaepresent.IsUnset() { + vals = append(vals, "larvaepresent") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Lstages.IsUnset() { + vals = append(vals, "lstages") + } + if !s.Numdips.IsUnset() { + vals = append(vals, "numdips") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Personalcontact.IsUnset() { + vals = append(vals, "personalcontact") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Posdips.IsUnset() { + vals = append(vals, "posdips") + } + if !s.Positivecontainercount.IsUnset() { + vals = append(vals, "positivecontainercount") + } + if !s.Pupaepresent.IsUnset() { + vals = append(vals, "pupaepresent") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sdid.IsUnset() { + vals = append(vals, "sdid") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Tirecount.IsUnset() { + vals = append(vals, "tirecount") + } + if !s.Totlarvae.IsUnset() { + vals = append(vals, "totlarvae") + } + if !s.Totpupae.IsUnset() { + vals = append(vals, "totpupae") + } + if !s.Visualmonitoring.IsUnset() { + vals = append(vals, "visualmonitoring") + } + if !s.Vmcomments.IsUnset() { + vals = append(vals, "vmcomments") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Adminaction.IsUnset() { + vals = append(vals, "adminaction") + } + if !s.Ptaid.IsUnset() { + vals = append(vals, "ptaid") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryMosquitoinspectionSetter) Overwrite(t *HistoryMosquitoinspection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Actiontaken.IsUnset() { + t.Actiontaken = s.Actiontaken.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Adultact.IsUnset() { + t.Adultact = s.Adultact.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Avglarvae.IsUnset() { + t.Avglarvae = s.Avglarvae.MustGetNull() + } + if !s.Avgpupae.IsUnset() { + t.Avgpupae = s.Avgpupae.MustGetNull() + } + if !s.Breeding.IsUnset() { + t.Breeding = s.Breeding.MustGetNull() + } + if !s.Cbcount.IsUnset() { + t.Cbcount = s.Cbcount.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Containercount.IsUnset() { + t.Containercount = s.Containercount.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Domstage.IsUnset() { + t.Domstage = s.Domstage.MustGetNull() + } + if !s.Eggs.IsUnset() { + t.Eggs = s.Eggs.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldspecies.IsUnset() { + t.Fieldspecies = s.Fieldspecies.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvaepresent.IsUnset() { + t.Larvaepresent = s.Larvaepresent.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Lstages.IsUnset() { + t.Lstages = s.Lstages.MustGetNull() + } + if !s.Numdips.IsUnset() { + t.Numdips = s.Numdips.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Personalcontact.IsUnset() { + t.Personalcontact = s.Personalcontact.MustGetNull() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Posdips.IsUnset() { + t.Posdips = s.Posdips.MustGetNull() + } + if !s.Positivecontainercount.IsUnset() { + t.Positivecontainercount = s.Positivecontainercount.MustGetNull() + } + if !s.Pupaepresent.IsUnset() { + t.Pupaepresent = s.Pupaepresent.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sdid.IsUnset() { + t.Sdid = s.Sdid.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Tirecount.IsUnset() { + t.Tirecount = s.Tirecount.MustGetNull() + } + if !s.Totlarvae.IsUnset() { + t.Totlarvae = s.Totlarvae.MustGetNull() + } + if !s.Totpupae.IsUnset() { + t.Totpupae = s.Totpupae.MustGetNull() + } + if !s.Visualmonitoring.IsUnset() { + t.Visualmonitoring = s.Visualmonitoring.MustGetNull() + } + if !s.Vmcomments.IsUnset() { + t.Vmcomments = s.Vmcomments.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Adminaction.IsUnset() { + t.Adminaction = s.Adminaction.MustGetNull() + } + if !s.Ptaid.IsUnset() { + t.Ptaid = s.Ptaid.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryMosquitoinspections.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, 61) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Actiontaken.IsUnset() { + vals[1] = psql.Arg(s.Actiontaken.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[2] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Adultact.IsUnset() { + vals[3] = psql.Arg(s.Adultact.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[4] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Avglarvae.IsUnset() { + vals[5] = psql.Arg(s.Avglarvae.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Avgpupae.IsUnset() { + vals[6] = psql.Arg(s.Avgpupae.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Breeding.IsUnset() { + vals[7] = psql.Arg(s.Breeding.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Cbcount.IsUnset() { + vals[8] = psql.Arg(s.Cbcount.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[9] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Containercount.IsUnset() { + vals[10] = psql.Arg(s.Containercount.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[11] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[12] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Domstage.IsUnset() { + vals[13] = psql.Arg(s.Domstage.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Eggs.IsUnset() { + vals[14] = psql.Arg(s.Eggs.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[15] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[16] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[17] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Fieldspecies.IsUnset() { + vals[18] = psql.Arg(s.Fieldspecies.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[19] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[20] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[21] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Larvaepresent.IsUnset() { + vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[23] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[24] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lstages.IsUnset() { + vals[25] = psql.Arg(s.Lstages.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Numdips.IsUnset() { + vals[26] = psql.Arg(s.Numdips.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[27] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Personalcontact.IsUnset() { + vals[28] = psql.Arg(s.Personalcontact.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[29] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[30] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Posdips.IsUnset() { + vals[31] = psql.Arg(s.Posdips.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Positivecontainercount.IsUnset() { + vals[32] = psql.Arg(s.Positivecontainercount.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Pupaepresent.IsUnset() { + vals[33] = psql.Arg(s.Pupaepresent.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[34] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[35] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[36] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[37] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[38] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Sdid.IsUnset() { + vals[39] = psql.Arg(s.Sdid.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[40] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[41] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[42] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Tirecount.IsUnset() { + vals[43] = psql.Arg(s.Tirecount.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Totlarvae.IsUnset() { + vals[44] = psql.Arg(s.Totlarvae.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Totpupae.IsUnset() { + vals[45] = psql.Arg(s.Totpupae.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Visualmonitoring.IsUnset() { + vals[46] = psql.Arg(s.Visualmonitoring.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Vmcomments.IsUnset() { + vals[47] = psql.Arg(s.Vmcomments.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[48] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[49] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[50] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[51] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[52] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[53] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[54] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[55] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[56] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[57] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Adminaction.IsUnset() { + vals[58] = psql.Arg(s.Adminaction.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.Ptaid.IsUnset() { + vals[59] = psql.Arg(s.Ptaid.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[60] = psql.Arg(s.Version.MustGet()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 61) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Actiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "actiontaken")...), + psql.Arg(s.Actiontaken), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Adultact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adultact")...), + psql.Arg(s.Adultact), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Avglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avglarvae")...), + psql.Arg(s.Avglarvae), + }}) + } + + if !s.Avgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avgpupae")...), + psql.Arg(s.Avgpupae), + }}) + } + + if !s.Breeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "breeding")...), + psql.Arg(s.Breeding), + }}) + } + + if !s.Cbcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cbcount")...), + psql.Arg(s.Cbcount), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Containercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containercount")...), + psql.Arg(s.Containercount), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Domstage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "domstage")...), + psql.Arg(s.Domstage), + }}) + } + + if !s.Eggs.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "eggs")...), + psql.Arg(s.Eggs), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldspecies")...), + psql.Arg(s.Fieldspecies), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaepresent")...), + psql.Arg(s.Larvaepresent), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Lstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lstages")...), + psql.Arg(s.Lstages), + }}) + } + + if !s.Numdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "numdips")...), + psql.Arg(s.Numdips), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Personalcontact.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "personalcontact")...), + psql.Arg(s.Personalcontact), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Posdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "posdips")...), + psql.Arg(s.Posdips), + }}) + } + + if !s.Positivecontainercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "positivecontainercount")...), + psql.Arg(s.Positivecontainercount), + }}) + } + + if !s.Pupaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pupaepresent")...), + psql.Arg(s.Pupaepresent), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sdid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sdid")...), + psql.Arg(s.Sdid), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Tirecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "tirecount")...), + psql.Arg(s.Tirecount), + }}) + } + + if !s.Totlarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totlarvae")...), + psql.Arg(s.Totlarvae), + }}) + } + + if !s.Totpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totpupae")...), + psql.Arg(s.Totpupae), + }}) + } + + if !s.Visualmonitoring.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "visualmonitoring")...), + psql.Arg(s.Visualmonitoring), + }}) + } + + if !s.Vmcomments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vmcomments")...), + psql.Arg(s.Vmcomments), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Adminaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adminaction")...), + psql.Arg(s.Adminaction), + }}) + } + + if !s.Ptaid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ptaid")...), + psql.Arg(s.Ptaid), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryMosquitoinspection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryMosquitoinspection, error) { + if len(cols) == 0 { + return HistoryMosquitoinspections.Query( + sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryMosquitoinspections.Query( + sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryMosquitoinspections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryMosquitoinspectionExists checks the presence of a single record by primary key +func HistoryMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryMosquitoinspections.Query( + sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryMosquitoinspection is retrieved from the database +func (o *HistoryMosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryMosquitoinspection +func (o *HistoryMosquitoinspection) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryMosquitoinspection) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).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 HistoryMosquitoinspection +func (o *HistoryMosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryMosquitoinspectionSetter) error { + v, err := HistoryMosquitoinspections.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 HistoryMosquitoinspection record with an executor +func (o *HistoryMosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryMosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryMosquitoinspection using the executor +func (o *HistoryMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryMosquitoinspections.Query( + sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryMosquitoinspectionSlice is retrieved from the database +func (o HistoryMosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryMosquitoinspectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).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 HistoryMosquitoinspectionSlice) copyMatchingRows(from ...*HistoryMosquitoinspection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection: + o.copyMatchingRows(retrieved) + case []*HistoryMosquitoinspection: + o.copyMatchingRows(retrieved...) + case HistoryMosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection + // then run the AfterUpdateHooks on the slice + _, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection: + o.copyMatchingRows(retrieved) + case []*HistoryMosquitoinspection: + o.copyMatchingRows(retrieved...) + case HistoryMosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection + // then run the AfterDeleteHooks on the slice + _, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryMosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryMosquitoinspectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryMosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryMosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryMosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryMosquitoinspections.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 *HistoryMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspection0 *HistoryMosquitoinspection, organization1 *Organization) (*HistoryMosquitoinspection, error) { + setter := &HistoryMosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyMosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryMosquitoinspectionOrganization0: %w", err) + } + + return historyMosquitoinspection0, nil +} + +func (historyMosquitoinspection0 *HistoryMosquitoinspection) 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 = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1) + if err != nil { + return err + } + + historyMosquitoinspection0.R.Organization = organization1 + + organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0) + + return nil +} + +func (historyMosquitoinspection0 *HistoryMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1) + if err != nil { + return err + } + + historyMosquitoinspection0.R.Organization = organization1 + + organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0) + + return nil +} + +type historyMosquitoinspectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Actiontaken psql.WhereNullMod[Q, string] + Activity psql.WhereNullMod[Q, string] + Adultact psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Avglarvae psql.WhereNullMod[Q, float64] + Avgpupae psql.WhereNullMod[Q, float64] + Breeding psql.WhereNullMod[Q, string] + Cbcount psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Containercount psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Domstage psql.WhereNullMod[Q, string] + Eggs psql.WhereNullMod[Q, int16] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldspecies psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Larvaepresent psql.WhereNullMod[Q, int16] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Lstages psql.WhereNullMod[Q, string] + Numdips psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Personalcontact psql.WhereNullMod[Q, int16] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Posdips psql.WhereNullMod[Q, int16] + Positivecontainercount psql.WhereNullMod[Q, int16] + Pupaepresent psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sdid psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Tirecount psql.WhereNullMod[Q, int16] + Totlarvae psql.WhereNullMod[Q, int16] + Totpupae psql.WhereNullMod[Q, int16] + Visualmonitoring psql.WhereNullMod[Q, int16] + Vmcomments psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Adminaction psql.WhereNullMod[Q, string] + Ptaid psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyMosquitoinspectionWhere[Q]) AliasedAs(alias string) historyMosquitoinspectionWhere[Q] { + return buildHistoryMosquitoinspectionWhere[Q](buildHistoryMosquitoinspectionColumns(alias)) +} + +func buildHistoryMosquitoinspectionWhere[Q psql.Filterable](cols historyMosquitoinspectionColumns) historyMosquitoinspectionWhere[Q] { + return historyMosquitoinspectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), + Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae), + Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae), + Breeding: psql.WhereNull[Q, string](cols.Breeding), + Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), + Comments: psql.WhereNull[Q, string](cols.Comments), + Containercount: psql.WhereNull[Q, int16](cols.Containercount), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Domstage: psql.WhereNull[Q, string](cols.Domstage), + Eggs: psql.WhereNull[Q, int16](cols.Eggs), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Lstages: psql.WhereNull[Q, string](cols.Lstages), + Numdips: psql.WhereNull[Q, int16](cols.Numdips), + Objectid: psql.Where[Q, int32](cols.Objectid), + Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Posdips: psql.WhereNull[Q, int16](cols.Posdips), + Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount), + Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sdid: psql.WhereNull[Q, string](cols.Sdid), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), + Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae), + Totpupae: psql.WhereNull[Q, int16](cols.Totpupae), + Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring), + Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Adminaction: psql.WhereNull[Q, string](cols.Adminaction), + Ptaid: psql.WhereNull[Q, string](cols.Ptaid), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryMosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyMosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("historyMosquitoinspection has no relationship %q", name) + } +} + +type historyMosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryMosquitoinspectionPreloader() historyMosquitoinspectionPreloader { + return historyMosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryMosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyMosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryMosquitoinspectionThenLoader[Q orm.Loadable]() historyMosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyMosquitoinspectionThenLoader[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 historyMosquitoinspection's Organization into the .R struct +func (o *HistoryMosquitoinspection) 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.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyMosquitoinspection's Organization into the .R struct +func (os HistoryMosquitoinspectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyMosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyMosquitoinspectionJoins[Q]) aliasedAs(alias string) historyMosquitoinspectionJoins[Q] { + return buildHistoryMosquitoinspectionJoins[Q](buildHistoryMosquitoinspectionColumns(alias), j.typ) +} + +func buildHistoryMosquitoinspectionJoins[Q dialect.Joinable](cols historyMosquitoinspectionColumns, typ string) historyMosquitoinspectionJoins[Q] { + return historyMosquitoinspectionJoins[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/history_pointlocation.bob.go b/models/history_pointlocation.bob.go new file mode 100644 index 00000000..f51dfec8 --- /dev/null +++ b/models/history_pointlocation.bob.go @@ -0,0 +1,1767 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// HistoryPointlocation is an object representing the database table. +type HistoryPointlocation 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" ` + 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" ` + 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" ` + Stype null.Val[string] `db:"stype" ` + Symbology null.Val[string] `db:"symbology" ` + Usetype null.Val[string] `db:"usetype" ` + Waterorigin null.Val[string] `db:"waterorigin" ` + X null.Val[float64] `db:"x" ` + Y null.Val[float64] `db:"y" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Assignedtech null.Val[string] `db:"assignedtech" ` + DeactivateReason null.Val[string] `db:"deactivate_reason" ` + Scalarpriority null.Val[int64] `db:"scalarpriority" ` + Sourcestatus null.Val[string] `db:"sourcestatus" ` + Version int32 `db:"version,pk" ` + + R historyPointlocationR `db:"-" ` +} + +// HistoryPointlocationSlice is an alias for a slice of pointers to HistoryPointlocation. +// This should almost always be used instead of []*HistoryPointlocation. +type HistoryPointlocationSlice []*HistoryPointlocation + +// HistoryPointlocations contains methods to work with the history_pointlocation table +var HistoryPointlocations = psql.NewTablex[*HistoryPointlocation, HistoryPointlocationSlice, *HistoryPointlocationSetter]("", "history_pointlocation", buildHistoryPointlocationColumns("history_pointlocation")) + +// HistoryPointlocationsQuery is a query on the history_pointlocation table +type HistoryPointlocationsQuery = *psql.ViewQuery[*HistoryPointlocation, HistoryPointlocationSlice] + +// historyPointlocationR is where relationships are stored. +type historyPointlocationR struct { + Organization *Organization // history_pointlocation.history_pointlocation_organization_id_fkey +} + +func buildHistoryPointlocationColumns(alias string) historyPointlocationColumns { + return historyPointlocationColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "stype", "symbology", "usetype", "waterorigin", "x", "y", "zone", "zone2", "geometry_x", "geometry_y", "assignedtech", "deactivate_reason", "scalarpriority", "sourcestatus", "version", + ).WithParent("history_pointlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Stype: psql.Quote(alias, "stype"), + Symbology: psql.Quote(alias, "symbology"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + X: psql.Quote(alias, "x"), + Y: psql.Quote(alias, "y"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Assignedtech: psql.Quote(alias, "assignedtech"), + DeactivateReason: psql.Quote(alias, "deactivate_reason"), + Scalarpriority: psql.Quote(alias, "scalarpriority"), + Sourcestatus: psql.Quote(alias, "sourcestatus"), + Version: psql.Quote(alias, "version"), + } +} + +type historyPointlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Stype psql.Expression + Symbology psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + X psql.Expression + Y psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Assignedtech psql.Expression + DeactivateReason psql.Expression + Scalarpriority psql.Expression + Sourcestatus psql.Expression + Version psql.Expression +} + +func (c historyPointlocationColumns) Alias() string { + return c.tableAlias +} + +func (historyPointlocationColumns) AliasedAs(alias string) historyPointlocationColumns { + return buildHistoryPointlocationColumns(alias) +} + +// HistoryPointlocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + 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" ` + 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" ` + Stype omitnull.Val[string] `db:"stype" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + X omitnull.Val[float64] `db:"x" ` + Y omitnull.Val[float64] `db:"y" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + DeactivateReason omitnull.Val[string] `db:"deactivate_reason" ` + Scalarpriority omitnull.Val[int64] `db:"scalarpriority" ` + Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` + Version omit.Val[int32] `db:"version,pk" ` +} + +func (s HistoryPointlocationSetter) SetColumns() []string { + vals := make([]string, 0, 48) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Stype.IsUnset() { + vals = append(vals, "stype") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.X.IsUnset() { + vals = append(vals, "x") + } + if !s.Y.IsUnset() { + vals = append(vals, "y") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.Assignedtech.IsUnset() { + vals = append(vals, "assignedtech") + } + if !s.DeactivateReason.IsUnset() { + vals = append(vals, "deactivate_reason") + } + if !s.Scalarpriority.IsUnset() { + vals = append(vals, "scalarpriority") + } + if !s.Sourcestatus.IsUnset() { + vals = append(vals, "sourcestatus") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryPointlocationSetter) Overwrite(t *HistoryPointlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Stype.IsUnset() { + t.Stype = s.Stype.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.X.IsUnset() { + t.X = s.X.MustGetNull() + } + if !s.Y.IsUnset() { + t.Y = s.Y.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.Assignedtech.IsUnset() { + t.Assignedtech = s.Assignedtech.MustGetNull() + } + if !s.DeactivateReason.IsUnset() { + t.DeactivateReason = s.DeactivateReason.MustGetNull() + } + if !s.Scalarpriority.IsUnset() { + t.Scalarpriority = s.Scalarpriority.MustGetNull() + } + if !s.Sourcestatus.IsUnset() { + t.Sourcestatus = s.Sourcestatus.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryPointlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryPointlocations.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, 48) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[10] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[11] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[12] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[13] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[14] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[15] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[23] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[24] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[25] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[28] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[29] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[30] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[31] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[32] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Stype.IsUnset() { + vals[33] = psql.Arg(s.Stype.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[34] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[35] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[36] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.X.IsUnset() { + vals[37] = psql.Arg(s.X.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Y.IsUnset() { + vals[38] = psql.Arg(s.Y.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[39] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[40] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[41] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[42] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Assignedtech.IsUnset() { + vals[43] = psql.Arg(s.Assignedtech.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.DeactivateReason.IsUnset() { + vals[44] = psql.Arg(s.DeactivateReason.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Scalarpriority.IsUnset() { + vals[45] = psql.Arg(s.Scalarpriority.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Sourcestatus.IsUnset() { + vals[46] = psql.Arg(s.Sourcestatus.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[47] = psql.Arg(s.Version.MustGet()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryPointlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 48) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Stype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "stype")...), + psql.Arg(s.Stype), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.X.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "x")...), + psql.Arg(s.X), + }}) + } + + if !s.Y.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "y")...), + psql.Arg(s.Y), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.Assignedtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "assignedtech")...), + psql.Arg(s.Assignedtech), + }}) + } + + if !s.DeactivateReason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deactivate_reason")...), + psql.Arg(s.DeactivateReason), + }}) + } + + if !s.Scalarpriority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scalarpriority")...), + psql.Arg(s.Scalarpriority), + }}) + } + + if !s.Sourcestatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sourcestatus")...), + psql.Arg(s.Sourcestatus), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryPointlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryPointlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPointlocation, error) { + if len(cols) == 0 { + return HistoryPointlocations.Query( + sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryPointlocations.Query( + sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryPointlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryPointlocationExists checks the presence of a single record by primary key +func HistoryPointlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryPointlocations.Query( + sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryPointlocation is retrieved from the database +func (o *HistoryPointlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPointlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryPointlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryPointlocation +func (o *HistoryPointlocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryPointlocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_pointlocation", "objectid"), psql.Quote("history_pointlocation", "version")).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 HistoryPointlocation +func (o *HistoryPointlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryPointlocationSetter) error { + v, err := HistoryPointlocations.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 HistoryPointlocation record with an executor +func (o *HistoryPointlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryPointlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryPointlocation using the executor +func (o *HistoryPointlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryPointlocations.Query( + sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryPointlocationSlice is retrieved from the database +func (o HistoryPointlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPointlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryPointlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryPointlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_pointlocation", "objectid"), psql.Quote("history_pointlocation", "version")).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 HistoryPointlocationSlice) copyMatchingRows(from ...*HistoryPointlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryPointlocationSlice) 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 HistoryPointlocations.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 *HistoryPointlocation: + o.copyMatchingRows(retrieved) + case []*HistoryPointlocation: + o.copyMatchingRows(retrieved...) + case HistoryPointlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPointlocation or a slice of HistoryPointlocation + // then run the AfterUpdateHooks on the slice + _, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryPointlocationSlice) 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 HistoryPointlocations.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 *HistoryPointlocation: + o.copyMatchingRows(retrieved) + case []*HistoryPointlocation: + o.copyMatchingRows(retrieved...) + case HistoryPointlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPointlocation or a slice of HistoryPointlocation + // then run the AfterDeleteHooks on the slice + _, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryPointlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPointlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPointlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryPointlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPointlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryPointlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryPointlocations.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 *HistoryPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryPointlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPointlocation0 *HistoryPointlocation, organization1 *Organization) (*HistoryPointlocation, error) { + setter := &HistoryPointlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyPointlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryPointlocationOrganization0: %w", err) + } + + return historyPointlocation0, nil +} + +func (historyPointlocation0 *HistoryPointlocation) 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 = attachHistoryPointlocationOrganization0(ctx, exec, 1, historyPointlocation0, organization1) + if err != nil { + return err + } + + historyPointlocation0.R.Organization = organization1 + + organization1.R.HistoryPointlocations = append(organization1.R.HistoryPointlocations, historyPointlocation0) + + return nil +} + +func (historyPointlocation0 *HistoryPointlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryPointlocationOrganization0(ctx, exec, 1, historyPointlocation0, organization1) + if err != nil { + return err + } + + historyPointlocation0.R.Organization = organization1 + + organization1.R.HistoryPointlocations = append(organization1.R.HistoryPointlocations, historyPointlocation0) + + return nil +} + +type historyPointlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Stype psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + X psql.WhereNullMod[Q, float64] + Y psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Assignedtech psql.WhereNullMod[Q, string] + DeactivateReason psql.WhereNullMod[Q, string] + Scalarpriority psql.WhereNullMod[Q, int64] + Sourcestatus psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyPointlocationWhere[Q]) AliasedAs(alias string) historyPointlocationWhere[Q] { + return buildHistoryPointlocationWhere[Q](buildHistoryPointlocationColumns(alias)) +} + +func buildHistoryPointlocationWhere[Q psql.Filterable](cols historyPointlocationColumns) historyPointlocationWhere[Q] { + return historyPointlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Stype: psql.WhereNull[Q, string](cols.Stype), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + X: psql.WhereNull[Q, float64](cols.X), + Y: psql.WhereNull[Q, float64](cols.Y), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), + DeactivateReason: psql.WhereNull[Q, string](cols.DeactivateReason), + Scalarpriority: psql.WhereNull[Q, int64](cols.Scalarpriority), + Sourcestatus: psql.WhereNull[Q, string](cols.Sourcestatus), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryPointlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyPointlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryPointlocations = HistoryPointlocationSlice{o} + } + return nil + default: + return fmt.Errorf("historyPointlocation has no relationship %q", name) + } +} + +type historyPointlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryPointlocationPreloader() historyPointlocationPreloader { + return historyPointlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryPointlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyPointlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryPointlocationThenLoader[Q orm.Loadable]() historyPointlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyPointlocationThenLoader[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 historyPointlocation's Organization into the .R struct +func (o *HistoryPointlocation) 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.HistoryPointlocations = HistoryPointlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyPointlocation's Organization into the .R struct +func (os HistoryPointlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryPointlocations = append(rel.R.HistoryPointlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyPointlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyPointlocationJoins[Q]) aliasedAs(alias string) historyPointlocationJoins[Q] { + return buildHistoryPointlocationJoins[Q](buildHistoryPointlocationColumns(alias), j.typ) +} + +func buildHistoryPointlocationJoins[Q dialect.Joinable](cols historyPointlocationColumns, typ string) historyPointlocationJoins[Q] { + return historyPointlocationJoins[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/history_polygonlocation.bob.go b/models/history_polygonlocation.bob.go new file mode 100644 index 00000000..af16ea4f --- /dev/null +++ b/models/history_polygonlocation.bob.go @@ -0,0 +1,1717 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// HistoryPolygonlocation is an object representing the database table. +type HistoryPolygonlocation 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" ` + Filter null.Val[string] `db:"filter" ` + 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" ` + 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" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Usetype null.Val[string] `db:"usetype" ` + Waterorigin null.Val[string] `db:"waterorigin" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Version int32 `db:"version,pk" ` + + R historyPolygonlocationR `db:"-" ` +} + +// HistoryPolygonlocationSlice is an alias for a slice of pointers to HistoryPolygonlocation. +// This should almost always be used instead of []*HistoryPolygonlocation. +type HistoryPolygonlocationSlice []*HistoryPolygonlocation + +// HistoryPolygonlocations contains methods to work with the history_polygonlocation table +var HistoryPolygonlocations = psql.NewTablex[*HistoryPolygonlocation, HistoryPolygonlocationSlice, *HistoryPolygonlocationSetter]("", "history_polygonlocation", buildHistoryPolygonlocationColumns("history_polygonlocation")) + +// HistoryPolygonlocationsQuery is a query on the history_polygonlocation table +type HistoryPolygonlocationsQuery = *psql.ViewQuery[*HistoryPolygonlocation, HistoryPolygonlocationSlice] + +// historyPolygonlocationR is where relationships are stored. +type historyPolygonlocationR struct { + Organization *Organization // history_polygonlocation.history_polygonlocation_organization_id_fkey +} + +func buildHistoryPolygonlocationColumns(alias string) historyPolygonlocationColumns { + return historyPolygonlocationColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "filter", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__area", "shape__length", "usetype", "waterorigin", "zone", "zone2", "geometry_x", "geometry_y", "version", + ).WithParent("history_polygonlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Acres: psql.Quote(alias, "acres"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Filter: psql.Quote(alias, "filter"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Hectares: psql.Quote(alias, "hectares"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), + Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), + Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), + Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), + Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), + Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), + Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Usetype: psql.Quote(alias, "usetype"), + Waterorigin: psql.Quote(alias, "waterorigin"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Version: psql.Quote(alias, "version"), + } +} + +type historyPolygonlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Acres psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Filter psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Hectares psql.Expression + Jurisdiction psql.Expression + Larvinspectinterval psql.Expression + Lastinspectactiontaken psql.Expression + Lastinspectactivity psql.Expression + Lastinspectavglarvae psql.Expression + Lastinspectavgpupae psql.Expression + Lastinspectbreeding psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectfieldspecies psql.Expression + Lastinspectlstages psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Usetype psql.Expression + Waterorigin psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Version psql.Expression +} + +func (c historyPolygonlocationColumns) Alias() string { + return c.tableAlias +} + +func (historyPolygonlocationColumns) AliasedAs(alias string) historyPolygonlocationColumns { + return buildHistoryPolygonlocationColumns(alias) +} + +// HistoryPolygonlocationSetter is used for insert/upsert/update operations +// 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" ` + 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" ` + Filter omitnull.Val[string] `db:"filter" ` + 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" ` + 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" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Version omit.Val[int32] `db:"version,pk" ` +} + +func (s HistoryPolygonlocationSetter) SetColumns() []string { + vals := make([]string, 0, 46) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Filter.IsUnset() { + vals = append(vals, "filter") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Larvinspectinterval.IsUnset() { + vals = append(vals, "larvinspectinterval") + } + if !s.Lastinspectactiontaken.IsUnset() { + vals = append(vals, "lastinspectactiontaken") + } + if !s.Lastinspectactivity.IsUnset() { + vals = append(vals, "lastinspectactivity") + } + if !s.Lastinspectavglarvae.IsUnset() { + vals = append(vals, "lastinspectavglarvae") + } + if !s.Lastinspectavgpupae.IsUnset() { + vals = append(vals, "lastinspectavgpupae") + } + if !s.Lastinspectbreeding.IsUnset() { + vals = append(vals, "lastinspectbreeding") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectfieldspecies.IsUnset() { + vals = append(vals, "lastinspectfieldspecies") + } + if !s.Lastinspectlstages.IsUnset() { + vals = append(vals, "lastinspectlstages") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Waterorigin.IsUnset() { + vals = append(vals, "waterorigin") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryPolygonlocationSetter) Overwrite(t *HistoryPolygonlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Filter.IsUnset() { + t.Filter = s.Filter.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Larvinspectinterval.IsUnset() { + t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() + } + if !s.Lastinspectactiontaken.IsUnset() { + t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() + } + if !s.Lastinspectactivity.IsUnset() { + t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() + } + if !s.Lastinspectavglarvae.IsUnset() { + t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() + } + if !s.Lastinspectavgpupae.IsUnset() { + t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() + } + if !s.Lastinspectbreeding.IsUnset() { + t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectfieldspecies.IsUnset() { + t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() + } + if !s.Lastinspectlstages.IsUnset() { + t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Waterorigin.IsUnset() { + t.Waterorigin = s.Waterorigin.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryPolygonlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryPolygonlocations.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, 46) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[2] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[3] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[7] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[8] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[9] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[10] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Filter.IsUnset() { + vals[11] = psql.Arg(s.Filter.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[12] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[13] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[14] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[15] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Larvinspectinterval.IsUnset() { + vals[16] = psql.Arg(s.Larvinspectinterval.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactiontaken.IsUnset() { + vals[17] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectactivity.IsUnset() { + vals[18] = psql.Arg(s.Lastinspectactivity.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavglarvae.IsUnset() { + vals[19] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectavgpupae.IsUnset() { + vals[20] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectbreeding.IsUnset() { + vals[21] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[22] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[23] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectfieldspecies.IsUnset() { + vals[24] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectlstages.IsUnset() { + vals[25] = psql.Arg(s.Lastinspectlstages.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[26] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[27] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[28] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[29] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[30] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[31] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[32] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[33] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[34] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[35] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[36] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[37] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[39] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Waterorigin.IsUnset() { + vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[41] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[42] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[43] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[44] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[45] = psql.Arg(s.Version.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 46) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Filter.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "filter")...), + psql.Arg(s.Filter), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Larvinspectinterval.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvinspectinterval")...), + psql.Arg(s.Larvinspectinterval), + }}) + } + + if !s.Lastinspectactiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactiontaken")...), + psql.Arg(s.Lastinspectactiontaken), + }}) + } + + if !s.Lastinspectactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectactivity")...), + psql.Arg(s.Lastinspectactivity), + }}) + } + + if !s.Lastinspectavglarvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavglarvae")...), + psql.Arg(s.Lastinspectavglarvae), + }}) + } + + if !s.Lastinspectavgpupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectavgpupae")...), + psql.Arg(s.Lastinspectavgpupae), + }}) + } + + if !s.Lastinspectbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectbreeding")...), + psql.Arg(s.Lastinspectbreeding), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectfieldspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectfieldspecies")...), + psql.Arg(s.Lastinspectfieldspecies), + }}) + } + + if !s.Lastinspectlstages.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectlstages")...), + psql.Arg(s.Lastinspectlstages), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Waterorigin.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterorigin")...), + psql.Arg(s.Waterorigin), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryPolygonlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPolygonlocation, error) { + if len(cols) == 0 { + return HistoryPolygonlocations.Query( + sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryPolygonlocations.Query( + sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryPolygonlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryPolygonlocationExists checks the presence of a single record by primary key +func HistoryPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryPolygonlocations.Query( + sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryPolygonlocation is retrieved from the database +func (o *HistoryPolygonlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryPolygonlocation +func (o *HistoryPolygonlocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryPolygonlocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_polygonlocation", "objectid"), psql.Quote("history_polygonlocation", "version")).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 HistoryPolygonlocation +func (o *HistoryPolygonlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryPolygonlocationSetter) error { + v, err := HistoryPolygonlocations.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 HistoryPolygonlocation record with an executor +func (o *HistoryPolygonlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryPolygonlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryPolygonlocation using the executor +func (o *HistoryPolygonlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryPolygonlocations.Query( + sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryPolygonlocationSlice is retrieved from the database +func (o HistoryPolygonlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryPolygonlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_polygonlocation", "objectid"), psql.Quote("history_polygonlocation", "version")).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 HistoryPolygonlocationSlice) copyMatchingRows(from ...*HistoryPolygonlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryPolygonlocationSlice) 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 HistoryPolygonlocations.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 *HistoryPolygonlocation: + o.copyMatchingRows(retrieved) + case []*HistoryPolygonlocation: + o.copyMatchingRows(retrieved...) + case HistoryPolygonlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPolygonlocation or a slice of HistoryPolygonlocation + // then run the AfterUpdateHooks on the slice + _, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryPolygonlocationSlice) 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 HistoryPolygonlocations.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 *HistoryPolygonlocation: + o.copyMatchingRows(retrieved) + case []*HistoryPolygonlocation: + o.copyMatchingRows(retrieved...) + case HistoryPolygonlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPolygonlocation or a slice of HistoryPolygonlocation + // then run the AfterDeleteHooks on the slice + _, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryPolygonlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPolygonlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPolygonlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryPolygonlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPolygonlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryPolygonlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryPolygonlocations.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 *HistoryPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocation0 *HistoryPolygonlocation, organization1 *Organization) (*HistoryPolygonlocation, error) { + setter := &HistoryPolygonlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyPolygonlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryPolygonlocationOrganization0: %w", err) + } + + return historyPolygonlocation0, nil +} + +func (historyPolygonlocation0 *HistoryPolygonlocation) 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 = attachHistoryPolygonlocationOrganization0(ctx, exec, 1, historyPolygonlocation0, organization1) + if err != nil { + return err + } + + historyPolygonlocation0.R.Organization = organization1 + + organization1.R.HistoryPolygonlocations = append(organization1.R.HistoryPolygonlocations, historyPolygonlocation0) + + return nil +} + +func (historyPolygonlocation0 *HistoryPolygonlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryPolygonlocationOrganization0(ctx, exec, 1, historyPolygonlocation0, organization1) + if err != nil { + return err + } + + historyPolygonlocation0.R.Organization = organization1 + + organization1.R.HistoryPolygonlocations = append(organization1.R.HistoryPolygonlocations, historyPolygonlocation0) + + return nil +} + +type historyPolygonlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Acres psql.WhereNullMod[Q, float64] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Filter psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Jurisdiction psql.WhereNullMod[Q, string] + Larvinspectinterval psql.WhereNullMod[Q, int16] + Lastinspectactiontaken psql.WhereNullMod[Q, string] + Lastinspectactivity psql.WhereNullMod[Q, string] + Lastinspectavglarvae psql.WhereNullMod[Q, float64] + Lastinspectavgpupae psql.WhereNullMod[Q, float64] + Lastinspectbreeding psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectfieldspecies psql.WhereNullMod[Q, string] + Lastinspectlstages psql.WhereNullMod[Q, string] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Usetype psql.WhereNullMod[Q, string] + Waterorigin psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Version psql.WhereMod[Q, int32] +} + +func (historyPolygonlocationWhere[Q]) AliasedAs(alias string) historyPolygonlocationWhere[Q] { + return buildHistoryPolygonlocationWhere[Q](buildHistoryPolygonlocationColumns(alias)) +} + +func buildHistoryPolygonlocationWhere[Q psql.Filterable](cols historyPolygonlocationColumns) historyPolygonlocationWhere[Q] { + return historyPolygonlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Filter: psql.WhereNull[Q, string](cols.Filter), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), + Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), + Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), + Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), + Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), + Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), + Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryPolygonlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyPolygonlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryPolygonlocations = HistoryPolygonlocationSlice{o} + } + return nil + default: + return fmt.Errorf("historyPolygonlocation has no relationship %q", name) + } +} + +type historyPolygonlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryPolygonlocationPreloader() historyPolygonlocationPreloader { + return historyPolygonlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryPolygonlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyPolygonlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryPolygonlocationThenLoader[Q orm.Loadable]() historyPolygonlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyPolygonlocationThenLoader[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 historyPolygonlocation's Organization into the .R struct +func (o *HistoryPolygonlocation) 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.HistoryPolygonlocations = HistoryPolygonlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyPolygonlocation's Organization into the .R struct +func (os HistoryPolygonlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryPolygonlocations = append(rel.R.HistoryPolygonlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyPolygonlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyPolygonlocationJoins[Q]) aliasedAs(alias string) historyPolygonlocationJoins[Q] { + return buildHistoryPolygonlocationJoins[Q](buildHistoryPolygonlocationColumns(alias), j.typ) +} + +func buildHistoryPolygonlocationJoins[Q dialect.Joinable](cols historyPolygonlocationColumns, typ string) historyPolygonlocationJoins[Q] { + return historyPolygonlocationJoins[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/history_pool.bob.go b/models/history_pool.bob.go new file mode 100644 index 00000000..00cf9d0a --- /dev/null +++ b/models/history_pool.bob.go @@ -0,0 +1,1367 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyPoolR `db:"-" ` +} + +// HistoryPoolSlice is an alias for a slice of pointers to HistoryPool. +// This should almost always be used instead of []*HistoryPool. +type HistoryPoolSlice []*HistoryPool + +// HistoryPools contains methods to work with the history_pool table +var HistoryPools = psql.NewTablex[*HistoryPool, HistoryPoolSlice, *HistoryPoolSetter]("", "history_pool", buildHistoryPoolColumns("history_pool")) + +// HistoryPoolsQuery is a query on the history_pool table +type HistoryPoolsQuery = *psql.ViewQuery[*HistoryPool, HistoryPoolSlice] + +// historyPoolR is where relationships are stored. +type historyPoolR struct { + Organization *Organization // history_pool.history_pool_organization_id_fkey +} + +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", + ).WithParent("history_pool"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datesent: psql.Quote(alias, "datesent"), + Datetested: psql.Quote(alias, "datetested"), + Diseasepos: psql.Quote(alias, "diseasepos"), + Diseasetested: psql.Quote(alias, "diseasetested"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Lab: psql.Quote(alias, "lab"), + LabID: psql.Quote(alias, "lab_id"), + Objectid: psql.Quote(alias, "objectid"), + Poolyear: psql.Quote(alias, "poolyear"), + Processed: psql.Quote(alias, "processed"), + Sampleid: psql.Quote(alias, "sampleid"), + Survtech: psql.Quote(alias, "survtech"), + Testmethod: psql.Quote(alias, "testmethod"), + Testtech: psql.Quote(alias, "testtech"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Vectorsurvcollectionid: psql.Quote(alias, "vectorsurvcollectionid"), + Vectorsurvpoolid: psql.Quote(alias, "vectorsurvpoolid"), + Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), + Version: psql.Quote(alias, "version"), + } +} + +type historyPoolColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datesent psql.Expression + Datetested psql.Expression + Diseasepos psql.Expression + Diseasetested psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Lab psql.Expression + LabID psql.Expression + Objectid psql.Expression + Poolyear psql.Expression + Processed psql.Expression + Sampleid psql.Expression + Survtech psql.Expression + Testmethod psql.Expression + Testtech psql.Expression + TrapdataID psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Vectorsurvcollectionid psql.Expression + Vectorsurvpoolid psql.Expression + Vectorsurvtrapdataid psql.Expression + Version psql.Expression +} + +func (c historyPoolColumns) Alias() string { + return c.tableAlias +} + +func (historyPoolColumns) AliasedAs(alias string) historyPoolColumns { + return buildHistoryPoolColumns(alias) +} + +// HistoryPoolSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryPoolSetter) SetColumns() []string { + vals := make([]string, 0, 32) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datesent.IsUnset() { + vals = append(vals, "datesent") + } + if !s.Datetested.IsUnset() { + vals = append(vals, "datetested") + } + if !s.Diseasepos.IsUnset() { + vals = append(vals, "diseasepos") + } + if !s.Diseasetested.IsUnset() { + vals = append(vals, "diseasetested") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lab.IsUnset() { + vals = append(vals, "lab") + } + if !s.LabID.IsUnset() { + vals = append(vals, "lab_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Poolyear.IsUnset() { + vals = append(vals, "poolyear") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.Survtech.IsUnset() { + vals = append(vals, "survtech") + } + if !s.Testmethod.IsUnset() { + vals = append(vals, "testmethod") + } + if !s.Testtech.IsUnset() { + vals = append(vals, "testtech") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Vectorsurvcollectionid.IsUnset() { + vals = append(vals, "vectorsurvcollectionid") + } + if !s.Vectorsurvpoolid.IsUnset() { + vals = append(vals, "vectorsurvpoolid") + } + if !s.Vectorsurvtrapdataid.IsUnset() { + vals = append(vals, "vectorsurvtrapdataid") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryPoolSetter) Overwrite(t *HistoryPool) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datesent.IsUnset() { + t.Datesent = s.Datesent.MustGetNull() + } + if !s.Datetested.IsUnset() { + t.Datetested = s.Datetested.MustGetNull() + } + if !s.Diseasepos.IsUnset() { + t.Diseasepos = s.Diseasepos.MustGetNull() + } + if !s.Diseasetested.IsUnset() { + t.Diseasetested = s.Diseasetested.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lab.IsUnset() { + t.Lab = s.Lab.MustGetNull() + } + if !s.LabID.IsUnset() { + t.LabID = s.LabID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Poolyear.IsUnset() { + t.Poolyear = s.Poolyear.MustGetNull() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.Survtech.IsUnset() { + t.Survtech = s.Survtech.MustGetNull() + } + if !s.Testmethod.IsUnset() { + t.Testmethod = s.Testmethod.MustGetNull() + } + if !s.Testtech.IsUnset() { + t.Testtech = s.Testtech.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Vectorsurvcollectionid.IsUnset() { + t.Vectorsurvcollectionid = s.Vectorsurvcollectionid.MustGetNull() + } + if !s.Vectorsurvpoolid.IsUnset() { + t.Vectorsurvpoolid = s.Vectorsurvpoolid.MustGetNull() + } + if !s.Vectorsurvtrapdataid.IsUnset() { + t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryPoolSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryPools.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, 32) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Datesent.IsUnset() { + vals[4] = psql.Arg(s.Datesent.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Datetested.IsUnset() { + vals[5] = psql.Arg(s.Datetested.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Diseasepos.IsUnset() { + vals[6] = psql.Arg(s.Diseasepos.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Diseasetested.IsUnset() { + vals[7] = psql.Arg(s.Diseasetested.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lab.IsUnset() { + vals[12] = psql.Arg(s.Lab.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.LabID.IsUnset() { + vals[13] = psql.Arg(s.LabID.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[14] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Poolyear.IsUnset() { + vals[15] = psql.Arg(s.Poolyear.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[16] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[17] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Survtech.IsUnset() { + vals[18] = psql.Arg(s.Survtech.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Testmethod.IsUnset() { + vals[19] = psql.Arg(s.Testmethod.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Testtech.IsUnset() { + vals[20] = psql.Arg(s.Testtech.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[21] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvcollectionid.IsUnset() { + vals[28] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvpoolid.IsUnset() { + vals[29] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[30] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[31] = psql.Arg(s.Version.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryPoolSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 32) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datesent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datesent")...), + psql.Arg(s.Datesent), + }}) + } + + if !s.Datetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetested")...), + psql.Arg(s.Datetested), + }}) + } + + if !s.Diseasepos.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasepos")...), + psql.Arg(s.Diseasepos), + }}) + } + + if !s.Diseasetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasetested")...), + psql.Arg(s.Diseasetested), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lab.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab")...), + psql.Arg(s.Lab), + }}) + } + + if !s.LabID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab_id")...), + psql.Arg(s.LabID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Poolyear.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "poolyear")...), + psql.Arg(s.Poolyear), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.Survtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "survtech")...), + psql.Arg(s.Survtech), + }}) + } + + if !s.Testmethod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testmethod")...), + psql.Arg(s.Testmethod), + }}) + } + + if !s.Testtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testtech")...), + psql.Arg(s.Testtech), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Vectorsurvcollectionid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvcollectionid")...), + psql.Arg(s.Vectorsurvcollectionid), + }}) + } + + if !s.Vectorsurvpoolid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvpoolid")...), + psql.Arg(s.Vectorsurvpoolid), + }}) + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtrapdataid")...), + psql.Arg(s.Vectorsurvtrapdataid), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryPool retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryPool(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPool, error) { + if len(cols) == 0 { + return HistoryPools.Query( + sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryPools.Query( + sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryPools.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryPoolExists checks the presence of a single record by primary key +func HistoryPoolExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryPools.Query( + sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryPool is retrieved from the database +func (o *HistoryPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPools.AfterSelectHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryPools.AfterInsertHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryPool +func (o *HistoryPool) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryPool) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_pool", "objectid"), psql.Quote("history_pool", "version")).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 HistoryPool +func (o *HistoryPool) Update(ctx context.Context, exec bob.Executor, s *HistoryPoolSetter) error { + v, err := HistoryPools.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 HistoryPool record with an executor +func (o *HistoryPool) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryPools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryPool using the executor +func (o *HistoryPool) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryPools.Query( + sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryPoolSlice is retrieved from the database +func (o HistoryPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPools.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryPools.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryPoolSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_pool", "objectid"), psql.Quote("history_pool", "version")).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 HistoryPoolSlice) copyMatchingRows(from ...*HistoryPool) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryPoolSlice) 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 HistoryPools.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 *HistoryPool: + o.copyMatchingRows(retrieved) + case []*HistoryPool: + o.copyMatchingRows(retrieved...) + case HistoryPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPool or a slice of HistoryPool + // then run the AfterUpdateHooks on the slice + _, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryPoolSlice) 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 HistoryPools.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 *HistoryPool: + o.copyMatchingRows(retrieved) + case []*HistoryPool: + o.copyMatchingRows(retrieved...) + case HistoryPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPool or a slice of HistoryPool + // then run the AfterDeleteHooks on the slice + _, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryPoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPoolSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryPoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPools.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryPools.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 *HistoryPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryPoolOrganization0(ctx context.Context, exec bob.Executor, count int, historyPool0 *HistoryPool, organization1 *Organization) (*HistoryPool, error) { + setter := &HistoryPoolSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyPool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryPoolOrganization0: %w", err) + } + + return historyPool0, nil +} + +func (historyPool0 *HistoryPool) 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 = attachHistoryPoolOrganization0(ctx, exec, 1, historyPool0, organization1) + if err != nil { + return err + } + + historyPool0.R.Organization = organization1 + + organization1.R.HistoryPools = append(organization1.R.HistoryPools, historyPool0) + + return nil +} + +func (historyPool0 *HistoryPool) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryPoolOrganization0(ctx, exec, 1, historyPool0, organization1) + if err != nil { + return err + } + + historyPool0.R.Organization = organization1 + + organization1.R.HistoryPools = append(organization1.R.HistoryPools, historyPool0) + + return nil +} + +type historyPoolWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datesent psql.WhereNullMod[Q, int64] + Datetested psql.WhereNullMod[Q, int64] + Diseasepos psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Lab psql.WhereNullMod[Q, string] + LabID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Poolyear psql.WhereNullMod[Q, int16] + Processed psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + Survtech psql.WhereNullMod[Q, string] + Testmethod psql.WhereNullMod[Q, string] + Testtech psql.WhereNullMod[Q, string] + TrapdataID psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Vectorsurvcollectionid psql.WhereNullMod[Q, string] + Vectorsurvpoolid psql.WhereNullMod[Q, string] + Vectorsurvtrapdataid psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyPoolWhere[Q]) AliasedAs(alias string) historyPoolWhere[Q] { + return buildHistoryPoolWhere[Q](buildHistoryPoolColumns(alias)) +} + +func buildHistoryPoolWhere[Q psql.Filterable](cols historyPoolColumns) historyPoolWhere[Q] { + return historyPoolWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Datesent: psql.WhereNull[Q, int64](cols.Datesent), + Datetested: psql.WhereNull[Q, int64](cols.Datetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lab: psql.WhereNull[Q, string](cols.Lab), + LabID: psql.WhereNull[Q, string](cols.LabID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Poolyear: psql.WhereNull[Q, int16](cols.Poolyear), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + Survtech: psql.WhereNull[Q, string](cols.Survtech), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Testtech: psql.WhereNull[Q, string](cols.Testtech), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Vectorsurvcollectionid: psql.WhereNull[Q, string](cols.Vectorsurvcollectionid), + Vectorsurvpoolid: psql.WhereNull[Q, string](cols.Vectorsurvpoolid), + Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryPool) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyPool cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryPools = HistoryPoolSlice{o} + } + return nil + default: + return fmt.Errorf("historyPool has no relationship %q", name) + } +} + +type historyPoolPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryPoolPreloader() historyPoolPreloader { + return historyPoolPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryPools, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyPoolThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryPoolThenLoader[Q orm.Loadable]() historyPoolThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyPoolThenLoader[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 historyPool's Organization into the .R struct +func (o *HistoryPool) 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.HistoryPools = HistoryPoolSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyPool's Organization into the .R struct +func (os HistoryPoolSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryPools = append(rel.R.HistoryPools, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyPoolJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyPoolJoins[Q]) aliasedAs(alias string) historyPoolJoins[Q] { + return buildHistoryPoolJoins[Q](buildHistoryPoolColumns(alias), j.typ) +} + +func buildHistoryPoolJoins[Q dialect.Joinable](cols historyPoolColumns, typ string) historyPoolJoins[Q] { + return historyPoolJoins[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/history_pooldetail.bob.go b/models/history_pooldetail.bob.go new file mode 100644 index 00000000..b5357aae --- /dev/null +++ b/models/history_pooldetail.bob.go @@ -0,0 +1,1017 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyPooldetailR `db:"-" ` +} + +// HistoryPooldetailSlice is an alias for a slice of pointers to HistoryPooldetail. +// This should almost always be used instead of []*HistoryPooldetail. +type HistoryPooldetailSlice []*HistoryPooldetail + +// HistoryPooldetails contains methods to work with the history_pooldetail table +var HistoryPooldetails = psql.NewTablex[*HistoryPooldetail, HistoryPooldetailSlice, *HistoryPooldetailSetter]("", "history_pooldetail", buildHistoryPooldetailColumns("history_pooldetail")) + +// HistoryPooldetailsQuery is a query on the history_pooldetail table +type HistoryPooldetailsQuery = *psql.ViewQuery[*HistoryPooldetail, HistoryPooldetailSlice] + +// historyPooldetailR is where relationships are stored. +type historyPooldetailR struct { + Organization *Organization // history_pooldetail.history_pooldetail_organization_id_fkey +} + +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", + ).WithParent("history_pooldetail"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Females: psql.Quote(alias, "females"), + Globalid: psql.Quote(alias, "globalid"), + Objectid: psql.Quote(alias, "objectid"), + PoolID: psql.Quote(alias, "pool_id"), + Species: psql.Quote(alias, "species"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyPooldetailColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Females psql.Expression + Globalid psql.Expression + Objectid psql.Expression + PoolID psql.Expression + Species psql.Expression + TrapdataID psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyPooldetailColumns) Alias() string { + return c.tableAlias +} + +func (historyPooldetailColumns) AliasedAs(alias string) historyPooldetailColumns { + return buildHistoryPooldetailColumns(alias) +} + +// HistoryPooldetailSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryPooldetailSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Females.IsUnset() { + vals = append(vals, "females") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.PoolID.IsUnset() { + vals = append(vals, "pool_id") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryPooldetailSetter) Overwrite(t *HistoryPooldetail) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Females.IsUnset() { + t.Females = s.Females.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.PoolID.IsUnset() { + t.PoolID = s.PoolID.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryPooldetailSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryPooldetails.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Females.IsUnset() { + vals[5] = psql.Arg(s.Females.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[7] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.PoolID.IsUnset() { + vals[8] = psql.Arg(s.PoolID.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[9] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[10] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryPooldetailSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Females.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "females")...), + psql.Arg(s.Females), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.PoolID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pool_id")...), + psql.Arg(s.PoolID), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryPooldetail retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPooldetail, error) { + if len(cols) == 0 { + return HistoryPooldetails.Query( + sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryPooldetails.Query( + sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryPooldetails.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryPooldetailExists checks the presence of a single record by primary key +func HistoryPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryPooldetails.Query( + sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryPooldetail is retrieved from the database +func (o *HistoryPooldetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPooldetails.AfterSelectHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryPooldetails.AfterInsertHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryPooldetail +func (o *HistoryPooldetail) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryPooldetail) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_pooldetail", "objectid"), psql.Quote("history_pooldetail", "version")).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 HistoryPooldetail +func (o *HistoryPooldetail) Update(ctx context.Context, exec bob.Executor, s *HistoryPooldetailSetter) error { + v, err := HistoryPooldetails.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 HistoryPooldetail record with an executor +func (o *HistoryPooldetail) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryPooldetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryPooldetail using the executor +func (o *HistoryPooldetail) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryPooldetails.Query( + sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryPooldetailSlice is retrieved from the database +func (o HistoryPooldetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryPooldetails.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryPooldetails.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryPooldetailSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_pooldetail", "objectid"), psql.Quote("history_pooldetail", "version")).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 HistoryPooldetailSlice) copyMatchingRows(from ...*HistoryPooldetail) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryPooldetailSlice) 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 HistoryPooldetails.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 *HistoryPooldetail: + o.copyMatchingRows(retrieved) + case []*HistoryPooldetail: + o.copyMatchingRows(retrieved...) + case HistoryPooldetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPooldetail or a slice of HistoryPooldetail + // then run the AfterUpdateHooks on the slice + _, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryPooldetailSlice) 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 HistoryPooldetails.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 *HistoryPooldetail: + o.copyMatchingRows(retrieved) + case []*HistoryPooldetail: + o.copyMatchingRows(retrieved...) + case HistoryPooldetailSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryPooldetail or a slice of HistoryPooldetail + // then run the AfterDeleteHooks on the slice + _, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryPooldetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPooldetailSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPooldetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryPooldetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryPooldetails.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryPooldetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryPooldetails.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 *HistoryPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyPooldetail0 *HistoryPooldetail, organization1 *Organization) (*HistoryPooldetail, error) { + setter := &HistoryPooldetailSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyPooldetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryPooldetailOrganization0: %w", err) + } + + return historyPooldetail0, nil +} + +func (historyPooldetail0 *HistoryPooldetail) 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 = attachHistoryPooldetailOrganization0(ctx, exec, 1, historyPooldetail0, organization1) + if err != nil { + return err + } + + historyPooldetail0.R.Organization = organization1 + + organization1.R.HistoryPooldetails = append(organization1.R.HistoryPooldetails, historyPooldetail0) + + return nil +} + +func (historyPooldetail0 *HistoryPooldetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryPooldetailOrganization0(ctx, exec, 1, historyPooldetail0, organization1) + if err != nil { + return err + } + + historyPooldetail0.R.Organization = organization1 + + organization1.R.HistoryPooldetails = append(organization1.R.HistoryPooldetails, historyPooldetail0) + + return nil +} + +type historyPooldetailWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Females psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + PoolID psql.WhereNullMod[Q, string] + Species psql.WhereNullMod[Q, string] + TrapdataID psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyPooldetailWhere[Q]) AliasedAs(alias string) historyPooldetailWhere[Q] { + return buildHistoryPooldetailWhere[Q](buildHistoryPooldetailColumns(alias)) +} + +func buildHistoryPooldetailWhere[Q psql.Filterable](cols historyPooldetailColumns) historyPooldetailWhere[Q] { + return historyPooldetailWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Females: psql.WhereNull[Q, int16](cols.Females), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Objectid: psql.Where[Q, int32](cols.Objectid), + PoolID: psql.WhereNull[Q, string](cols.PoolID), + Species: psql.WhereNull[Q, string](cols.Species), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryPooldetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyPooldetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryPooldetails = HistoryPooldetailSlice{o} + } + return nil + default: + return fmt.Errorf("historyPooldetail has no relationship %q", name) + } +} + +type historyPooldetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryPooldetailPreloader() historyPooldetailPreloader { + return historyPooldetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryPooldetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyPooldetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryPooldetailThenLoader[Q orm.Loadable]() historyPooldetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyPooldetailThenLoader[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 historyPooldetail's Organization into the .R struct +func (o *HistoryPooldetail) 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.HistoryPooldetails = HistoryPooldetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyPooldetail's Organization into the .R struct +func (os HistoryPooldetailSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryPooldetails = append(rel.R.HistoryPooldetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyPooldetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyPooldetailJoins[Q]) aliasedAs(alias string) historyPooldetailJoins[Q] { + return buildHistoryPooldetailJoins[Q](buildHistoryPooldetailColumns(alias), j.typ) +} + +func buildHistoryPooldetailJoins[Q dialect.Joinable](cols historyPooldetailColumns, typ string) historyPooldetailJoins[Q] { + return historyPooldetailJoins[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/history_proposedtreatmentarea.bob.go b/models/history_proposedtreatmentarea.bob.go new file mode 100644 index 00000000..7dc6c55a --- /dev/null +++ b/models/history_proposedtreatmentarea.bob.go @@ -0,0 +1,1492 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// HistoryProposedtreatmentarea is an object representing the database table. +type HistoryProposedtreatmentarea struct { + OrganizationID null.Val[int32] `db:"organization_id" ` + Acres null.Val[float64] `db:"acres" ` + Comments null.Val[string] `db:"comments" ` + Completed null.Val[int16] `db:"completed" ` + Completedby null.Val[string] `db:"completedby" ` + Completeddate null.Val[int64] `db:"completeddate" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Duedate null.Val[int64] `db:"duedate" ` + Exported null.Val[int16] `db:"exported" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Hectares null.Val[float64] `db:"hectares" ` + Issprayroute null.Val[int16] `db:"issprayroute" ` + 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" ` + Method null.Val[string] `db:"method" ` + Name null.Val[string] `db:"name" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Targetapprate null.Val[float64] `db:"targetapprate" ` + Targetproduct null.Val[string] `db:"targetproduct" ` + Targetspecies null.Val[string] `db:"targetspecies" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + Version int32 `db:"version,pk" ` + + R historyProposedtreatmentareaR `db:"-" ` +} + +// HistoryProposedtreatmentareaSlice is an alias for a slice of pointers to HistoryProposedtreatmentarea. +// This should almost always be used instead of []*HistoryProposedtreatmentarea. +type HistoryProposedtreatmentareaSlice []*HistoryProposedtreatmentarea + +// HistoryProposedtreatmentareas contains methods to work with the history_proposedtreatmentarea table +var HistoryProposedtreatmentareas = psql.NewTablex[*HistoryProposedtreatmentarea, HistoryProposedtreatmentareaSlice, *HistoryProposedtreatmentareaSetter]("", "history_proposedtreatmentarea", buildHistoryProposedtreatmentareaColumns("history_proposedtreatmentarea")) + +// HistoryProposedtreatmentareasQuery is a query on the history_proposedtreatmentarea table +type HistoryProposedtreatmentareasQuery = *psql.ViewQuery[*HistoryProposedtreatmentarea, HistoryProposedtreatmentareaSlice] + +// historyProposedtreatmentareaR is where relationships are stored. +type historyProposedtreatmentareaR struct { + Organization *Organization // history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey +} + +func buildHistoryProposedtreatmentareaColumns(alias string) historyProposedtreatmentareaColumns { + return historyProposedtreatmentareaColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "acres", "comments", "completed", "completedby", "completeddate", "creationdate", "creator", "duedate", "exported", "editdate", "editor", "globalid", "hectares", "issprayroute", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "method", "name", "objectid", "priority", "reviewed", "reviewedby", "revieweddate", "shape__area", "shape__length", "targetapprate", "targetproduct", "targetspecies", "zone", "zone2", "geometry_x", "geometry_y", "version", + ).WithParent("history_proposedtreatmentarea"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Acres: psql.Quote(alias, "acres"), + Comments: psql.Quote(alias, "comments"), + Completed: psql.Quote(alias, "completed"), + Completedby: psql.Quote(alias, "completedby"), + Completeddate: psql.Quote(alias, "completeddate"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Duedate: psql.Quote(alias, "duedate"), + Exported: psql.Quote(alias, "exported"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Hectares: psql.Quote(alias, "hectares"), + Issprayroute: psql.Quote(alias, "issprayroute"), + Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), + Lasttreatqty: psql.Quote(alias, "lasttreatqty"), + Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), + Method: psql.Quote(alias, "method"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Targetapprate: psql.Quote(alias, "targetapprate"), + Targetproduct: psql.Quote(alias, "targetproduct"), + Targetspecies: psql.Quote(alias, "targetspecies"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + Version: psql.Quote(alias, "version"), + } +} + +type historyProposedtreatmentareaColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Acres psql.Expression + Comments psql.Expression + Completed psql.Expression + Completedby psql.Expression + Completeddate psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Duedate psql.Expression + Exported psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Hectares psql.Expression + Issprayroute psql.Expression + Lasttreatactivity psql.Expression + Lasttreatdate psql.Expression + Lasttreatproduct psql.Expression + Lasttreatqty psql.Expression + Lasttreatqtyunit psql.Expression + Method psql.Expression + Name psql.Expression + Objectid psql.Expression + Priority psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Targetapprate psql.Expression + Targetproduct psql.Expression + Targetspecies psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + Version psql.Expression +} + +func (c historyProposedtreatmentareaColumns) Alias() string { + return c.tableAlias +} + +func (historyProposedtreatmentareaColumns) AliasedAs(alias string) historyProposedtreatmentareaColumns { + return buildHistoryProposedtreatmentareaColumns(alias) +} + +// HistoryProposedtreatmentareaSetter is used for insert/upsert/update operations +// 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" ` + Acres omitnull.Val[float64] `db:"acres" ` + Comments omitnull.Val[string] `db:"comments" ` + Completed omitnull.Val[int16] `db:"completed" ` + Completedby omitnull.Val[string] `db:"completedby" ` + Completeddate omitnull.Val[int64] `db:"completeddate" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Duedate omitnull.Val[int64] `db:"duedate" ` + Exported omitnull.Val[int16] `db:"exported" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Issprayroute omitnull.Val[int16] `db:"issprayroute" ` + 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" ` + Method omitnull.Val[string] `db:"method" ` + Name omitnull.Val[string] `db:"name" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Targetapprate omitnull.Val[float64] `db:"targetapprate" ` + Targetproduct omitnull.Val[string] `db:"targetproduct" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + Version omit.Val[int32] `db:"version,pk" ` +} + +func (s HistoryProposedtreatmentareaSetter) SetColumns() []string { + vals := make([]string, 0, 37) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Acres.IsUnset() { + vals = append(vals, "acres") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Completed.IsUnset() { + vals = append(vals, "completed") + } + if !s.Completedby.IsUnset() { + vals = append(vals, "completedby") + } + if !s.Completeddate.IsUnset() { + vals = append(vals, "completeddate") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Duedate.IsUnset() { + vals = append(vals, "duedate") + } + if !s.Exported.IsUnset() { + vals = append(vals, "exported") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Hectares.IsUnset() { + vals = append(vals, "hectares") + } + if !s.Issprayroute.IsUnset() { + vals = append(vals, "issprayroute") + } + if !s.Lasttreatactivity.IsUnset() { + vals = append(vals, "lasttreatactivity") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Lasttreatproduct.IsUnset() { + vals = append(vals, "lasttreatproduct") + } + if !s.Lasttreatqty.IsUnset() { + vals = append(vals, "lasttreatqty") + } + if !s.Lasttreatqtyunit.IsUnset() { + vals = append(vals, "lasttreatqtyunit") + } + if !s.Method.IsUnset() { + vals = append(vals, "method") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Targetapprate.IsUnset() { + vals = append(vals, "targetapprate") + } + if !s.Targetproduct.IsUnset() { + vals = append(vals, "targetproduct") + } + if !s.Targetspecies.IsUnset() { + vals = append(vals, "targetspecies") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryProposedtreatmentareaSetter) Overwrite(t *HistoryProposedtreatmentarea) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Acres.IsUnset() { + t.Acres = s.Acres.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Completed.IsUnset() { + t.Completed = s.Completed.MustGetNull() + } + if !s.Completedby.IsUnset() { + t.Completedby = s.Completedby.MustGetNull() + } + if !s.Completeddate.IsUnset() { + t.Completeddate = s.Completeddate.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Duedate.IsUnset() { + t.Duedate = s.Duedate.MustGetNull() + } + if !s.Exported.IsUnset() { + t.Exported = s.Exported.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Hectares.IsUnset() { + t.Hectares = s.Hectares.MustGetNull() + } + if !s.Issprayroute.IsUnset() { + t.Issprayroute = s.Issprayroute.MustGetNull() + } + if !s.Lasttreatactivity.IsUnset() { + t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Lasttreatproduct.IsUnset() { + t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() + } + if !s.Lasttreatqty.IsUnset() { + t.Lasttreatqty = s.Lasttreatqty.MustGetNull() + } + if !s.Lasttreatqtyunit.IsUnset() { + t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() + } + if !s.Method.IsUnset() { + t.Method = s.Method.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Targetapprate.IsUnset() { + t.Targetapprate = s.Targetapprate.MustGetNull() + } + if !s.Targetproduct.IsUnset() { + t.Targetproduct = s.Targetproduct.MustGetNull() + } + if !s.Targetspecies.IsUnset() { + t.Targetspecies = s.Targetspecies.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryProposedtreatmentareas.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, 37) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Acres.IsUnset() { + vals[1] = psql.Arg(s.Acres.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Completed.IsUnset() { + vals[3] = psql.Arg(s.Completed.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Completedby.IsUnset() { + vals[4] = psql.Arg(s.Completedby.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Completeddate.IsUnset() { + vals[5] = psql.Arg(s.Completeddate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[6] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[7] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Duedate.IsUnset() { + vals[8] = psql.Arg(s.Duedate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Exported.IsUnset() { + vals[9] = psql.Arg(s.Exported.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[10] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[11] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[12] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Hectares.IsUnset() { + vals[13] = psql.Arg(s.Hectares.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Issprayroute.IsUnset() { + vals[14] = psql.Arg(s.Issprayroute.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatactivity.IsUnset() { + vals[15] = psql.Arg(s.Lasttreatactivity.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[16] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatproduct.IsUnset() { + vals[17] = psql.Arg(s.Lasttreatproduct.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqty.IsUnset() { + vals[18] = psql.Arg(s.Lasttreatqty.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatqtyunit.IsUnset() { + vals[19] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Method.IsUnset() { + vals[20] = psql.Arg(s.Method.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[21] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[22] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[23] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[24] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[25] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[26] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[27] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[28] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Targetapprate.IsUnset() { + vals[29] = psql.Arg(s.Targetapprate.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Targetproduct.IsUnset() { + vals[30] = psql.Arg(s.Targetproduct.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Targetspecies.IsUnset() { + vals[31] = psql.Arg(s.Targetspecies.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[32] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[33] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[34] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[35] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[36] = psql.Arg(s.Version.MustGet()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 37) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Acres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acres")...), + psql.Arg(s.Acres), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Completed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completed")...), + psql.Arg(s.Completed), + }}) + } + + if !s.Completedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completedby")...), + psql.Arg(s.Completedby), + }}) + } + + if !s.Completeddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "completeddate")...), + psql.Arg(s.Completeddate), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Duedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "duedate")...), + psql.Arg(s.Duedate), + }}) + } + + if !s.Exported.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "exported")...), + psql.Arg(s.Exported), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Hectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "hectares")...), + psql.Arg(s.Hectares), + }}) + } + + if !s.Issprayroute.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "issprayroute")...), + psql.Arg(s.Issprayroute), + }}) + } + + if !s.Lasttreatactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatactivity")...), + psql.Arg(s.Lasttreatactivity), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Lasttreatproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatproduct")...), + psql.Arg(s.Lasttreatproduct), + }}) + } + + if !s.Lasttreatqty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqty")...), + psql.Arg(s.Lasttreatqty), + }}) + } + + if !s.Lasttreatqtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatqtyunit")...), + psql.Arg(s.Lasttreatqtyunit), + }}) + } + + if !s.Method.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "method")...), + psql.Arg(s.Method), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Targetapprate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetapprate")...), + psql.Arg(s.Targetapprate), + }}) + } + + if !s.Targetproduct.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetproduct")...), + psql.Arg(s.Targetproduct), + }}) + } + + if !s.Targetspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetspecies")...), + psql.Arg(s.Targetspecies), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryProposedtreatmentarea retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryProposedtreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryProposedtreatmentarea, error) { + if len(cols) == 0 { + return HistoryProposedtreatmentareas.Query( + sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryProposedtreatmentareas.Query( + sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryProposedtreatmentareas.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryProposedtreatmentareaExists checks the presence of a single record by primary key +func HistoryProposedtreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryProposedtreatmentareas.Query( + sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryProposedtreatmentarea is retrieved from the database +func (o *HistoryProposedtreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryProposedtreatmentarea +func (o *HistoryProposedtreatmentarea) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryProposedtreatmentarea) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_proposedtreatmentarea", "objectid"), psql.Quote("history_proposedtreatmentarea", "version")).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 HistoryProposedtreatmentarea +func (o *HistoryProposedtreatmentarea) Update(ctx context.Context, exec bob.Executor, s *HistoryProposedtreatmentareaSetter) error { + v, err := HistoryProposedtreatmentareas.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 HistoryProposedtreatmentarea record with an executor +func (o *HistoryProposedtreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryProposedtreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryProposedtreatmentarea using the executor +func (o *HistoryProposedtreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryProposedtreatmentareas.Query( + sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryProposedtreatmentareaSlice is retrieved from the database +func (o HistoryProposedtreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryProposedtreatmentareaSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_proposedtreatmentarea", "objectid"), psql.Quote("history_proposedtreatmentarea", "version")).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 HistoryProposedtreatmentareaSlice) copyMatchingRows(from ...*HistoryProposedtreatmentarea) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryProposedtreatmentareaSlice) 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 HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea: + o.copyMatchingRows(retrieved) + case []*HistoryProposedtreatmentarea: + o.copyMatchingRows(retrieved...) + case HistoryProposedtreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryProposedtreatmentarea or a slice of HistoryProposedtreatmentarea + // then run the AfterUpdateHooks on the slice + _, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryProposedtreatmentareaSlice) 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 HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea: + o.copyMatchingRows(retrieved) + case []*HistoryProposedtreatmentarea: + o.copyMatchingRows(retrieved...) + case HistoryProposedtreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryProposedtreatmentarea or a slice of HistoryProposedtreatmentarea + // then run the AfterDeleteHooks on the slice + _, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryProposedtreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryProposedtreatmentareaSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryProposedtreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryProposedtreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryProposedtreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryProposedtreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentarea0 *HistoryProposedtreatmentarea, organization1 *Organization) (*HistoryProposedtreatmentarea, error) { + setter := &HistoryProposedtreatmentareaSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyProposedtreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryProposedtreatmentareaOrganization0: %w", err) + } + + return historyProposedtreatmentarea0, nil +} + +func (historyProposedtreatmentarea0 *HistoryProposedtreatmentarea) 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 = attachHistoryProposedtreatmentareaOrganization0(ctx, exec, 1, historyProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + historyProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.HistoryProposedtreatmentareas = append(organization1.R.HistoryProposedtreatmentareas, historyProposedtreatmentarea0) + + return nil +} + +func (historyProposedtreatmentarea0 *HistoryProposedtreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryProposedtreatmentareaOrganization0(ctx, exec, 1, historyProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + historyProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.HistoryProposedtreatmentareas = append(organization1.R.HistoryProposedtreatmentareas, historyProposedtreatmentarea0) + + return nil +} + +type historyProposedtreatmentareaWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Acres psql.WhereNullMod[Q, float64] + Comments psql.WhereNullMod[Q, string] + Completed psql.WhereNullMod[Q, int16] + Completedby psql.WhereNullMod[Q, string] + Completeddate psql.WhereNullMod[Q, int64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Duedate psql.WhereNullMod[Q, int64] + Exported psql.WhereNullMod[Q, int16] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Hectares psql.WhereNullMod[Q, float64] + Issprayroute psql.WhereNullMod[Q, int16] + Lasttreatactivity psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Lasttreatproduct psql.WhereNullMod[Q, string] + Lasttreatqty psql.WhereNullMod[Q, float64] + Lasttreatqtyunit psql.WhereNullMod[Q, string] + Method psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Targetapprate psql.WhereNullMod[Q, float64] + Targetproduct psql.WhereNullMod[Q, string] + Targetspecies psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + Version psql.WhereMod[Q, int32] +} + +func (historyProposedtreatmentareaWhere[Q]) AliasedAs(alias string) historyProposedtreatmentareaWhere[Q] { + return buildHistoryProposedtreatmentareaWhere[Q](buildHistoryProposedtreatmentareaColumns(alias)) +} + +func buildHistoryProposedtreatmentareaWhere[Q psql.Filterable](cols historyProposedtreatmentareaColumns) historyProposedtreatmentareaWhere[Q] { + return historyProposedtreatmentareaWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Completedby: psql.WhereNull[Q, string](cols.Completedby), + Completeddate: psql.WhereNull[Q, int64](cols.Completeddate), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Duedate: psql.WhereNull[Q, int64](cols.Duedate), + Exported: psql.WhereNull[Q, int16](cols.Exported), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Hectares: psql.WhereNull[Q, float64](cols.Hectares), + Issprayroute: psql.WhereNull[Q, int16](cols.Issprayroute), + Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), + Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), + Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), + Method: psql.WhereNull[Q, string](cols.Method), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Targetapprate: psql.WhereNull[Q, float64](cols.Targetapprate), + Targetproduct: psql.WhereNull[Q, string](cols.Targetproduct), + Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryProposedtreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyProposedtreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryProposedtreatmentareas = HistoryProposedtreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("historyProposedtreatmentarea has no relationship %q", name) + } +} + +type historyProposedtreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryProposedtreatmentareaPreloader() historyProposedtreatmentareaPreloader { + return historyProposedtreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryProposedtreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyProposedtreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryProposedtreatmentareaThenLoader[Q orm.Loadable]() historyProposedtreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyProposedtreatmentareaThenLoader[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 historyProposedtreatmentarea's Organization into the .R struct +func (o *HistoryProposedtreatmentarea) 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.HistoryProposedtreatmentareas = HistoryProposedtreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyProposedtreatmentarea's Organization into the .R struct +func (os HistoryProposedtreatmentareaSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryProposedtreatmentareas = append(rel.R.HistoryProposedtreatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyProposedtreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyProposedtreatmentareaJoins[Q]) aliasedAs(alias string) historyProposedtreatmentareaJoins[Q] { + return buildHistoryProposedtreatmentareaJoins[Q](buildHistoryProposedtreatmentareaColumns(alias), j.typ) +} + +func buildHistoryProposedtreatmentareaJoins[Q dialect.Joinable](cols historyProposedtreatmentareaColumns, typ string) historyProposedtreatmentareaJoins[Q] { + return historyProposedtreatmentareaJoins[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/history_qamosquitoinspection.bob.go b/models/history_qamosquitoinspection.bob.go new file mode 100644 index 00000000..0128ac5c --- /dev/null +++ b/models/history_qamosquitoinspection.bob.go @@ -0,0 +1,2217 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyQamosquitoinspectionR `db:"-" ` +} + +// HistoryQamosquitoinspectionSlice is an alias for a slice of pointers to HistoryQamosquitoinspection. +// This should almost always be used instead of []*HistoryQamosquitoinspection. +type HistoryQamosquitoinspectionSlice []*HistoryQamosquitoinspection + +// HistoryQamosquitoinspections contains methods to work with the history_qamosquitoinspection table +var HistoryQamosquitoinspections = psql.NewTablex[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice, *HistoryQamosquitoinspectionSetter]("", "history_qamosquitoinspection", buildHistoryQamosquitoinspectionColumns("history_qamosquitoinspection")) + +// HistoryQamosquitoinspectionsQuery is a query on the history_qamosquitoinspection table +type HistoryQamosquitoinspectionsQuery = *psql.ViewQuery[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice] + +// historyQamosquitoinspectionR is where relationships are stored. +type historyQamosquitoinspectionR struct { + Organization *Organization // history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey +} + +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", + ).WithParent("history_qamosquitoinspection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Acresbreeding: psql.Quote(alias, "acresbreeding"), + Actiontaken: psql.Quote(alias, "actiontaken"), + Adultactivity: psql.Quote(alias, "adultactivity"), + Aquaticorganisms: psql.Quote(alias, "aquaticorganisms"), + Avetemp: psql.Quote(alias, "avetemp"), + Breedingpotential: psql.Quote(alias, "breedingpotential"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Fish: psql.Quote(alias, "fish"), + Globalid: psql.Quote(alias, "globalid"), + Habvalue1: psql.Quote(alias, "habvalue1"), + Habvalue1percent: psql.Quote(alias, "habvalue1percent"), + Habvalue2: psql.Quote(alias, "habvalue2"), + Habvalue2percent: psql.Quote(alias, "habvalue2percent"), + Larvaeinsidetreatedarea: psql.Quote(alias, "larvaeinsidetreatedarea"), + Larvaeoutsidetreatedarea: psql.Quote(alias, "larvaeoutsidetreatedarea"), + Larvaepresent: psql.Quote(alias, "larvaepresent"), + Larvaereason: psql.Quote(alias, "larvaereason"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + LR: psql.Quote(alias, "lr"), + Mosquitohabitat: psql.Quote(alias, "mosquitohabitat"), + Movingwater: psql.Quote(alias, "movingwater"), + Negdips: psql.Quote(alias, "negdips"), + Nowaterever: psql.Quote(alias, "nowaterever"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Posdips: psql.Quote(alias, "posdips"), + Potential: psql.Quote(alias, "potential"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sitetype: psql.Quote(alias, "sitetype"), + Soilconditions: psql.Quote(alias, "soilconditions"), + Sourcereduction: psql.Quote(alias, "sourcereduction"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Totalacres: psql.Quote(alias, "totalacres"), + Vegetation: psql.Quote(alias, "vegetation"), + Waterconditions: psql.Quote(alias, "waterconditions"), + Waterduration: psql.Quote(alias, "waterduration"), + Watermovement1: psql.Quote(alias, "watermovement1"), + Watermovement1percent: psql.Quote(alias, "watermovement1percent"), + Watermovement2: psql.Quote(alias, "watermovement2"), + Watermovement2percent: psql.Quote(alias, "watermovement2percent"), + Waterpresent: psql.Quote(alias, "waterpresent"), + Watersource: psql.Quote(alias, "watersource"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyQamosquitoinspectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Acresbreeding psql.Expression + Actiontaken psql.Expression + Adultactivity psql.Expression + Aquaticorganisms psql.Expression + Avetemp psql.Expression + Breedingpotential psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Fish psql.Expression + Globalid psql.Expression + Habvalue1 psql.Expression + Habvalue1percent psql.Expression + Habvalue2 psql.Expression + Habvalue2percent psql.Expression + Larvaeinsidetreatedarea psql.Expression + Larvaeoutsidetreatedarea psql.Expression + Larvaepresent psql.Expression + Larvaereason psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + LR psql.Expression + Mosquitohabitat psql.Expression + Movingwater psql.Expression + Negdips psql.Expression + Nowaterever psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Posdips psql.Expression + Potential psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sitetype psql.Expression + Soilconditions psql.Expression + Sourcereduction psql.Expression + Startdatetime psql.Expression + Totalacres psql.Expression + Vegetation psql.Expression + Waterconditions psql.Expression + Waterduration psql.Expression + Watermovement1 psql.Expression + Watermovement1percent psql.Expression + Watermovement2 psql.Expression + Watermovement2percent psql.Expression + Waterpresent psql.Expression + Watersource psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyQamosquitoinspectionColumns) Alias() string { + return c.tableAlias +} + +func (historyQamosquitoinspectionColumns) AliasedAs(alias string) historyQamosquitoinspectionColumns { + return buildHistoryQamosquitoinspectionColumns(alias) +} + +// HistoryQamosquitoinspectionSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryQamosquitoinspectionSetter) SetColumns() []string { + vals := make([]string, 0, 66) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Acresbreeding.IsUnset() { + vals = append(vals, "acresbreeding") + } + if !s.Actiontaken.IsUnset() { + vals = append(vals, "actiontaken") + } + if !s.Adultactivity.IsUnset() { + vals = append(vals, "adultactivity") + } + if !s.Aquaticorganisms.IsUnset() { + vals = append(vals, "aquaticorganisms") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Breedingpotential.IsUnset() { + vals = append(vals, "breedingpotential") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Fish.IsUnset() { + vals = append(vals, "fish") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habvalue1.IsUnset() { + vals = append(vals, "habvalue1") + } + if !s.Habvalue1percent.IsUnset() { + vals = append(vals, "habvalue1percent") + } + if !s.Habvalue2.IsUnset() { + vals = append(vals, "habvalue2") + } + if !s.Habvalue2percent.IsUnset() { + vals = append(vals, "habvalue2percent") + } + if !s.Larvaeinsidetreatedarea.IsUnset() { + vals = append(vals, "larvaeinsidetreatedarea") + } + if !s.Larvaeoutsidetreatedarea.IsUnset() { + vals = append(vals, "larvaeoutsidetreatedarea") + } + if !s.Larvaepresent.IsUnset() { + vals = append(vals, "larvaepresent") + } + if !s.Larvaereason.IsUnset() { + vals = append(vals, "larvaereason") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LR.IsUnset() { + vals = append(vals, "lr") + } + if !s.Mosquitohabitat.IsUnset() { + vals = append(vals, "mosquitohabitat") + } + if !s.Movingwater.IsUnset() { + vals = append(vals, "movingwater") + } + if !s.Negdips.IsUnset() { + vals = append(vals, "negdips") + } + if !s.Nowaterever.IsUnset() { + vals = append(vals, "nowaterever") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Posdips.IsUnset() { + vals = append(vals, "posdips") + } + if !s.Potential.IsUnset() { + vals = append(vals, "potential") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sitetype.IsUnset() { + vals = append(vals, "sitetype") + } + if !s.Soilconditions.IsUnset() { + vals = append(vals, "soilconditions") + } + if !s.Sourcereduction.IsUnset() { + vals = append(vals, "sourcereduction") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Totalacres.IsUnset() { + vals = append(vals, "totalacres") + } + if !s.Vegetation.IsUnset() { + vals = append(vals, "vegetation") + } + if !s.Waterconditions.IsUnset() { + vals = append(vals, "waterconditions") + } + if !s.Waterduration.IsUnset() { + vals = append(vals, "waterduration") + } + if !s.Watermovement1.IsUnset() { + vals = append(vals, "watermovement1") + } + if !s.Watermovement1percent.IsUnset() { + vals = append(vals, "watermovement1percent") + } + if !s.Watermovement2.IsUnset() { + vals = append(vals, "watermovement2") + } + if !s.Watermovement2percent.IsUnset() { + vals = append(vals, "watermovement2percent") + } + if !s.Waterpresent.IsUnset() { + vals = append(vals, "waterpresent") + } + if !s.Watersource.IsUnset() { + vals = append(vals, "watersource") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryQamosquitoinspectionSetter) Overwrite(t *HistoryQamosquitoinspection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Acresbreeding.IsUnset() { + t.Acresbreeding = s.Acresbreeding.MustGetNull() + } + if !s.Actiontaken.IsUnset() { + t.Actiontaken = s.Actiontaken.MustGetNull() + } + if !s.Adultactivity.IsUnset() { + t.Adultactivity = s.Adultactivity.MustGetNull() + } + if !s.Aquaticorganisms.IsUnset() { + t.Aquaticorganisms = s.Aquaticorganisms.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Breedingpotential.IsUnset() { + t.Breedingpotential = s.Breedingpotential.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Fish.IsUnset() { + t.Fish = s.Fish.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habvalue1.IsUnset() { + t.Habvalue1 = s.Habvalue1.MustGetNull() + } + if !s.Habvalue1percent.IsUnset() { + t.Habvalue1percent = s.Habvalue1percent.MustGetNull() + } + if !s.Habvalue2.IsUnset() { + t.Habvalue2 = s.Habvalue2.MustGetNull() + } + if !s.Habvalue2percent.IsUnset() { + t.Habvalue2percent = s.Habvalue2percent.MustGetNull() + } + if !s.Larvaeinsidetreatedarea.IsUnset() { + t.Larvaeinsidetreatedarea = s.Larvaeinsidetreatedarea.MustGetNull() + } + if !s.Larvaeoutsidetreatedarea.IsUnset() { + t.Larvaeoutsidetreatedarea = s.Larvaeoutsidetreatedarea.MustGetNull() + } + if !s.Larvaepresent.IsUnset() { + t.Larvaepresent = s.Larvaepresent.MustGetNull() + } + if !s.Larvaereason.IsUnset() { + t.Larvaereason = s.Larvaereason.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LR.IsUnset() { + t.LR = s.LR.MustGetNull() + } + if !s.Mosquitohabitat.IsUnset() { + t.Mosquitohabitat = s.Mosquitohabitat.MustGetNull() + } + if !s.Movingwater.IsUnset() { + t.Movingwater = s.Movingwater.MustGetNull() + } + if !s.Negdips.IsUnset() { + t.Negdips = s.Negdips.MustGetNull() + } + if !s.Nowaterever.IsUnset() { + t.Nowaterever = s.Nowaterever.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Posdips.IsUnset() { + t.Posdips = s.Posdips.MustGetNull() + } + if !s.Potential.IsUnset() { + t.Potential = s.Potential.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sitetype.IsUnset() { + t.Sitetype = s.Sitetype.MustGetNull() + } + if !s.Soilconditions.IsUnset() { + t.Soilconditions = s.Soilconditions.MustGetNull() + } + if !s.Sourcereduction.IsUnset() { + t.Sourcereduction = s.Sourcereduction.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Totalacres.IsUnset() { + t.Totalacres = s.Totalacres.MustGetNull() + } + if !s.Vegetation.IsUnset() { + t.Vegetation = s.Vegetation.MustGetNull() + } + if !s.Waterconditions.IsUnset() { + t.Waterconditions = s.Waterconditions.MustGetNull() + } + if !s.Waterduration.IsUnset() { + t.Waterduration = s.Waterduration.MustGetNull() + } + if !s.Watermovement1.IsUnset() { + t.Watermovement1 = s.Watermovement1.MustGetNull() + } + if !s.Watermovement1percent.IsUnset() { + t.Watermovement1percent = s.Watermovement1percent.MustGetNull() + } + if !s.Watermovement2.IsUnset() { + t.Watermovement2 = s.Watermovement2.MustGetNull() + } + if !s.Watermovement2percent.IsUnset() { + t.Watermovement2percent = s.Watermovement2percent.MustGetNull() + } + if !s.Waterpresent.IsUnset() { + t.Waterpresent = s.Waterpresent.MustGetNull() + } + if !s.Watersource.IsUnset() { + t.Watersource = s.Watersource.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryQamosquitoinspections.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, 66) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Acresbreeding.IsUnset() { + vals[1] = psql.Arg(s.Acresbreeding.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Actiontaken.IsUnset() { + vals[2] = psql.Arg(s.Actiontaken.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Adultactivity.IsUnset() { + vals[3] = psql.Arg(s.Adultactivity.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Aquaticorganisms.IsUnset() { + vals[4] = psql.Arg(s.Aquaticorganisms.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[5] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Breedingpotential.IsUnset() { + vals[6] = psql.Arg(s.Breedingpotential.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[7] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[8] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[9] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[11] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[12] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[13] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fish.IsUnset() { + vals[14] = psql.Arg(s.Fish.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[15] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Habvalue1.IsUnset() { + vals[16] = psql.Arg(s.Habvalue1.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Habvalue1percent.IsUnset() { + vals[17] = psql.Arg(s.Habvalue1percent.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Habvalue2.IsUnset() { + vals[18] = psql.Arg(s.Habvalue2.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Habvalue2percent.IsUnset() { + vals[19] = psql.Arg(s.Habvalue2percent.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Larvaeinsidetreatedarea.IsUnset() { + vals[20] = psql.Arg(s.Larvaeinsidetreatedarea.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Larvaeoutsidetreatedarea.IsUnset() { + vals[21] = psql.Arg(s.Larvaeoutsidetreatedarea.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Larvaepresent.IsUnset() { + vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Larvaereason.IsUnset() { + vals[23] = psql.Arg(s.Larvaereason.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[24] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[25] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LR.IsUnset() { + vals[26] = psql.Arg(s.LR.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Mosquitohabitat.IsUnset() { + vals[27] = psql.Arg(s.Mosquitohabitat.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Movingwater.IsUnset() { + vals[28] = psql.Arg(s.Movingwater.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Negdips.IsUnset() { + vals[29] = psql.Arg(s.Negdips.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Nowaterever.IsUnset() { + vals[30] = psql.Arg(s.Nowaterever.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[31] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[32] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[33] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Posdips.IsUnset() { + vals[34] = psql.Arg(s.Posdips.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Potential.IsUnset() { + vals[35] = psql.Arg(s.Potential.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[36] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[37] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[38] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[39] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[40] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Sitetype.IsUnset() { + vals[41] = psql.Arg(s.Sitetype.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Soilconditions.IsUnset() { + vals[42] = psql.Arg(s.Soilconditions.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Sourcereduction.IsUnset() { + vals[43] = psql.Arg(s.Sourcereduction.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[44] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Totalacres.IsUnset() { + vals[45] = psql.Arg(s.Totalacres.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Vegetation.IsUnset() { + vals[46] = psql.Arg(s.Vegetation.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Waterconditions.IsUnset() { + vals[47] = psql.Arg(s.Waterconditions.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Waterduration.IsUnset() { + vals[48] = psql.Arg(s.Waterduration.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Watermovement1.IsUnset() { + vals[49] = psql.Arg(s.Watermovement1.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Watermovement1percent.IsUnset() { + vals[50] = psql.Arg(s.Watermovement1percent.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Watermovement2.IsUnset() { + vals[51] = psql.Arg(s.Watermovement2.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Watermovement2percent.IsUnset() { + vals[52] = psql.Arg(s.Watermovement2percent.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Waterpresent.IsUnset() { + vals[53] = psql.Arg(s.Waterpresent.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.Watersource.IsUnset() { + vals[54] = psql.Arg(s.Watersource.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[55] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[56] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[57] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[58] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[59] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[60] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[61] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[61] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[62] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[62] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[63] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[63] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[64] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[64] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[65] = psql.Arg(s.Version.MustGet()) + } else { + vals[65] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 66) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Acresbreeding.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acresbreeding")...), + psql.Arg(s.Acresbreeding), + }}) + } + + if !s.Actiontaken.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "actiontaken")...), + psql.Arg(s.Actiontaken), + }}) + } + + if !s.Adultactivity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "adultactivity")...), + psql.Arg(s.Adultactivity), + }}) + } + + if !s.Aquaticorganisms.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "aquaticorganisms")...), + psql.Arg(s.Aquaticorganisms), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Breedingpotential.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "breedingpotential")...), + psql.Arg(s.Breedingpotential), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Fish.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fish")...), + psql.Arg(s.Fish), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habvalue1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue1")...), + psql.Arg(s.Habvalue1), + }}) + } + + if !s.Habvalue1percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue1percent")...), + psql.Arg(s.Habvalue1percent), + }}) + } + + if !s.Habvalue2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue2")...), + psql.Arg(s.Habvalue2), + }}) + } + + if !s.Habvalue2percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habvalue2percent")...), + psql.Arg(s.Habvalue2percent), + }}) + } + + if !s.Larvaeinsidetreatedarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaeinsidetreatedarea")...), + psql.Arg(s.Larvaeinsidetreatedarea), + }}) + } + + if !s.Larvaeoutsidetreatedarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaeoutsidetreatedarea")...), + psql.Arg(s.Larvaeoutsidetreatedarea), + }}) + } + + if !s.Larvaepresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaepresent")...), + psql.Arg(s.Larvaepresent), + }}) + } + + if !s.Larvaereason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvaereason")...), + psql.Arg(s.Larvaereason), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LR.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lr")...), + psql.Arg(s.LR), + }}) + } + + if !s.Mosquitohabitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "mosquitohabitat")...), + psql.Arg(s.Mosquitohabitat), + }}) + } + + if !s.Movingwater.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "movingwater")...), + psql.Arg(s.Movingwater), + }}) + } + + if !s.Negdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "negdips")...), + psql.Arg(s.Negdips), + }}) + } + + if !s.Nowaterever.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nowaterever")...), + psql.Arg(s.Nowaterever), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Posdips.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "posdips")...), + psql.Arg(s.Posdips), + }}) + } + + if !s.Potential.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "potential")...), + psql.Arg(s.Potential), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sitetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitetype")...), + psql.Arg(s.Sitetype), + }}) + } + + if !s.Soilconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "soilconditions")...), + psql.Arg(s.Soilconditions), + }}) + } + + if !s.Sourcereduction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sourcereduction")...), + psql.Arg(s.Sourcereduction), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Totalacres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totalacres")...), + psql.Arg(s.Totalacres), + }}) + } + + if !s.Vegetation.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vegetation")...), + psql.Arg(s.Vegetation), + }}) + } + + if !s.Waterconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterconditions")...), + psql.Arg(s.Waterconditions), + }}) + } + + if !s.Waterduration.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterduration")...), + psql.Arg(s.Waterduration), + }}) + } + + if !s.Watermovement1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement1")...), + psql.Arg(s.Watermovement1), + }}) + } + + if !s.Watermovement1percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement1percent")...), + psql.Arg(s.Watermovement1percent), + }}) + } + + if !s.Watermovement2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement2")...), + psql.Arg(s.Watermovement2), + }}) + } + + if !s.Watermovement2percent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watermovement2percent")...), + psql.Arg(s.Watermovement2percent), + }}) + } + + if !s.Waterpresent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "waterpresent")...), + psql.Arg(s.Waterpresent), + }}) + } + + if !s.Watersource.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "watersource")...), + psql.Arg(s.Watersource), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryQamosquitoinspection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryQamosquitoinspection, error) { + if len(cols) == 0 { + return HistoryQamosquitoinspections.Query( + sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryQamosquitoinspections.Query( + sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryQamosquitoinspections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryQamosquitoinspectionExists checks the presence of a single record by primary key +func HistoryQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryQamosquitoinspections.Query( + sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryQamosquitoinspection is retrieved from the database +func (o *HistoryQamosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryQamosquitoinspection +func (o *HistoryQamosquitoinspection) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryQamosquitoinspection) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).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 HistoryQamosquitoinspection +func (o *HistoryQamosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryQamosquitoinspectionSetter) error { + v, err := HistoryQamosquitoinspections.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 HistoryQamosquitoinspection record with an executor +func (o *HistoryQamosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryQamosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryQamosquitoinspection using the executor +func (o *HistoryQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryQamosquitoinspections.Query( + sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryQamosquitoinspectionSlice is retrieved from the database +func (o HistoryQamosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryQamosquitoinspectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).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 HistoryQamosquitoinspectionSlice) copyMatchingRows(from ...*HistoryQamosquitoinspection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection: + o.copyMatchingRows(retrieved) + case []*HistoryQamosquitoinspection: + o.copyMatchingRows(retrieved...) + case HistoryQamosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection + // then run the AfterUpdateHooks on the slice + _, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection: + o.copyMatchingRows(retrieved) + case []*HistoryQamosquitoinspection: + o.copyMatchingRows(retrieved...) + case HistoryQamosquitoinspectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection + // then run the AfterDeleteHooks on the slice + _, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryQamosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryQamosquitoinspectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryQamosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryQamosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryQamosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspection0 *HistoryQamosquitoinspection, organization1 *Organization) (*HistoryQamosquitoinspection, error) { + setter := &HistoryQamosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyQamosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryQamosquitoinspectionOrganization0: %w", err) + } + + return historyQamosquitoinspection0, nil +} + +func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) 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 = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1) + if err != nil { + return err + } + + historyQamosquitoinspection0.R.Organization = organization1 + + organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0) + + return nil +} + +func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1) + if err != nil { + return err + } + + historyQamosquitoinspection0.R.Organization = organization1 + + organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0) + + return nil +} + +type historyQamosquitoinspectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Acresbreeding psql.WhereNullMod[Q, float64] + Actiontaken psql.WhereNullMod[Q, string] + Adultactivity psql.WhereNullMod[Q, int16] + Aquaticorganisms psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Breedingpotential psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Fish psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habvalue1 psql.WhereNullMod[Q, int16] + Habvalue1percent psql.WhereNullMod[Q, int16] + Habvalue2 psql.WhereNullMod[Q, int16] + Habvalue2percent psql.WhereNullMod[Q, int16] + Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaepresent psql.WhereNullMod[Q, int16] + Larvaereason psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LR psql.WhereNullMod[Q, int16] + Mosquitohabitat psql.WhereNullMod[Q, string] + Movingwater psql.WhereNullMod[Q, int16] + Negdips psql.WhereNullMod[Q, int16] + Nowaterever psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Posdips psql.WhereNullMod[Q, int16] + Potential psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sitetype psql.WhereNullMod[Q, string] + Soilconditions psql.WhereNullMod[Q, string] + Sourcereduction psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Totalacres psql.WhereNullMod[Q, float64] + Vegetation psql.WhereNullMod[Q, string] + Waterconditions psql.WhereNullMod[Q, string] + Waterduration psql.WhereNullMod[Q, string] + Watermovement1 psql.WhereNullMod[Q, string] + Watermovement1percent psql.WhereNullMod[Q, int16] + Watermovement2 psql.WhereNullMod[Q, string] + Watermovement2percent psql.WhereNullMod[Q, int16] + Waterpresent psql.WhereNullMod[Q, int16] + Watersource psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyQamosquitoinspectionWhere[Q]) AliasedAs(alias string) historyQamosquitoinspectionWhere[Q] { + return buildHistoryQamosquitoinspectionWhere[Q](buildHistoryQamosquitoinspectionColumns(alias)) +} + +func buildHistoryQamosquitoinspectionWhere[Q psql.Filterable](cols historyQamosquitoinspectionColumns) historyQamosquitoinspectionWhere[Q] { + return historyQamosquitoinspectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms), + Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), + Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Fish: psql.WhereNull[Q, int16](cols.Fish), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1), + Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent), + Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2), + Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent), + Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea), + Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LR: psql.WhereNull[Q, int16](cols.LR), + Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat), + Movingwater: psql.WhereNull[Q, int16](cols.Movingwater), + Negdips: psql.WhereNull[Q, int16](cols.Negdips), + Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Posdips: psql.WhereNull[Q, int16](cols.Posdips), + Potential: psql.WhereNull[Q, int16](cols.Potential), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sitetype: psql.WhereNull[Q, string](cols.Sitetype), + Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions), + Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Totalacres: psql.WhereNull[Q, float64](cols.Totalacres), + Vegetation: psql.WhereNull[Q, string](cols.Vegetation), + Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions), + Waterduration: psql.WhereNull[Q, string](cols.Waterduration), + Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1), + Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent), + Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2), + Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent), + Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent), + Watersource: psql.WhereNull[Q, string](cols.Watersource), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryQamosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyQamosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("historyQamosquitoinspection has no relationship %q", name) + } +} + +type historyQamosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryQamosquitoinspectionPreloader() historyQamosquitoinspectionPreloader { + return historyQamosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryQamosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyQamosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryQamosquitoinspectionThenLoader[Q orm.Loadable]() historyQamosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyQamosquitoinspectionThenLoader[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 historyQamosquitoinspection's Organization into the .R struct +func (o *HistoryQamosquitoinspection) 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.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyQamosquitoinspection's Organization into the .R struct +func (os HistoryQamosquitoinspectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryQamosquitoinspections = append(rel.R.HistoryQamosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyQamosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyQamosquitoinspectionJoins[Q]) aliasedAs(alias string) historyQamosquitoinspectionJoins[Q] { + return buildHistoryQamosquitoinspectionJoins[Q](buildHistoryQamosquitoinspectionColumns(alias), j.typ) +} + +func buildHistoryQamosquitoinspectionJoins[Q dialect.Joinable](cols historyQamosquitoinspectionColumns, typ string) historyQamosquitoinspectionJoins[Q] { + return historyQamosquitoinspectionJoins[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/history_rodentlocation.bob.go b/models/history_rodentlocation.bob.go new file mode 100644 index 00000000..b896444e --- /dev/null +++ b/models/history_rodentlocation.bob.go @@ -0,0 +1,1417 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyRodentlocationR `db:"-" ` +} + +// HistoryRodentlocationSlice is an alias for a slice of pointers to HistoryRodentlocation. +// This should almost always be used instead of []*HistoryRodentlocation. +type HistoryRodentlocationSlice []*HistoryRodentlocation + +// HistoryRodentlocations contains methods to work with the history_rodentlocation table +var HistoryRodentlocations = psql.NewTablex[*HistoryRodentlocation, HistoryRodentlocationSlice, *HistoryRodentlocationSetter]("", "history_rodentlocation", buildHistoryRodentlocationColumns("history_rodentlocation")) + +// HistoryRodentlocationsQuery is a query on the history_rodentlocation table +type HistoryRodentlocationsQuery = *psql.ViewQuery[*HistoryRodentlocation, HistoryRodentlocationSlice] + +// historyRodentlocationR is where relationships are stored. +type historyRodentlocationR struct { + Organization *Organization // history_rodentlocation.history_rodentlocation_organization_id_fkey +} + +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", + ).WithParent("history_rodentlocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Lastinspectaction: psql.Quote(alias, "lastinspectaction"), + Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), + Lastinspectdate: psql.Quote(alias, "lastinspectdate"), + Lastinspectrodentevidence: psql.Quote(alias, "lastinspectrodentevidence"), + Lastinspectspecies: psql.Quote(alias, "lastinspectspecies"), + Locationname: psql.Quote(alias, "locationname"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Symbology: psql.Quote(alias, "symbology"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Version: psql.Quote(alias, "version"), + } +} + +type historyRodentlocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Lastinspectaction psql.Expression + Lastinspectconditions psql.Expression + Lastinspectdate psql.Expression + Lastinspectrodentevidence psql.Expression + Lastinspectspecies psql.Expression + Locationname psql.Expression + Locationnumber psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Symbology psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Jurisdiction psql.Expression + Version psql.Expression +} + +func (c historyRodentlocationColumns) Alias() string { + return c.tableAlias +} + +func (historyRodentlocationColumns) AliasedAs(alias string) historyRodentlocationColumns { + return buildHistoryRodentlocationColumns(alias) +} + +// HistoryRodentlocationSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryRodentlocationSetter) SetColumns() []string { + vals := make([]string, 0, 34) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Lastinspectaction.IsUnset() { + vals = append(vals, "lastinspectaction") + } + if !s.Lastinspectconditions.IsUnset() { + vals = append(vals, "lastinspectconditions") + } + if !s.Lastinspectdate.IsUnset() { + vals = append(vals, "lastinspectdate") + } + if !s.Lastinspectrodentevidence.IsUnset() { + vals = append(vals, "lastinspectrodentevidence") + } + if !s.Lastinspectspecies.IsUnset() { + vals = append(vals, "lastinspectspecies") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryRodentlocationSetter) Overwrite(t *HistoryRodentlocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Lastinspectaction.IsUnset() { + t.Lastinspectaction = s.Lastinspectaction.MustGetNull() + } + if !s.Lastinspectconditions.IsUnset() { + t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() + } + if !s.Lastinspectdate.IsUnset() { + t.Lastinspectdate = s.Lastinspectdate.MustGetNull() + } + if !s.Lastinspectrodentevidence.IsUnset() { + t.Lastinspectrodentevidence = s.Lastinspectrodentevidence.MustGetNull() + } + if !s.Lastinspectspecies.IsUnset() { + t.Lastinspectspecies = s.Lastinspectspecies.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryRodentlocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryRodentlocations.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, 34) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[10] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[11] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectaction.IsUnset() { + vals[12] = psql.Arg(s.Lastinspectaction.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectconditions.IsUnset() { + vals[13] = psql.Arg(s.Lastinspectconditions.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectdate.IsUnset() { + vals[14] = psql.Arg(s.Lastinspectdate.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectrodentevidence.IsUnset() { + vals[15] = psql.Arg(s.Lastinspectrodentevidence.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Lastinspectspecies.IsUnset() { + vals[16] = psql.Arg(s.Lastinspectspecies.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[17] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[18] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[19] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[20] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[21] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[22] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[23] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[24] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[25] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[26] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[27] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[28] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[29] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[30] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[31] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[32] = psql.Arg(s.Jurisdiction.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, "", ", ", "") + })) +} + +func (s HistoryRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 34) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Lastinspectaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectaction")...), + psql.Arg(s.Lastinspectaction), + }}) + } + + if !s.Lastinspectconditions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectconditions")...), + psql.Arg(s.Lastinspectconditions), + }}) + } + + if !s.Lastinspectdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectdate")...), + psql.Arg(s.Lastinspectdate), + }}) + } + + if !s.Lastinspectrodentevidence.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectrodentevidence")...), + psql.Arg(s.Lastinspectrodentevidence), + }}) + } + + if !s.Lastinspectspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastinspectspecies")...), + psql.Arg(s.Lastinspectspecies), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryRodentlocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryRodentlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryRodentlocation, error) { + if len(cols) == 0 { + return HistoryRodentlocations.Query( + sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryRodentlocations.Query( + sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryRodentlocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryRodentlocationExists checks the presence of a single record by primary key +func HistoryRodentlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryRodentlocations.Query( + sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryRodentlocation is retrieved from the database +func (o *HistoryRodentlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryRodentlocation +func (o *HistoryRodentlocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryRodentlocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_rodentlocation", "objectid"), psql.Quote("history_rodentlocation", "version")).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 HistoryRodentlocation +func (o *HistoryRodentlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryRodentlocationSetter) error { + v, err := HistoryRodentlocations.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 HistoryRodentlocation record with an executor +func (o *HistoryRodentlocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryRodentlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryRodentlocation using the executor +func (o *HistoryRodentlocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryRodentlocations.Query( + sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryRodentlocationSlice is retrieved from the database +func (o HistoryRodentlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryRodentlocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_rodentlocation", "objectid"), psql.Quote("history_rodentlocation", "version")).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 HistoryRodentlocationSlice) copyMatchingRows(from ...*HistoryRodentlocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryRodentlocationSlice) 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 HistoryRodentlocations.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 *HistoryRodentlocation: + o.copyMatchingRows(retrieved) + case []*HistoryRodentlocation: + o.copyMatchingRows(retrieved...) + case HistoryRodentlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryRodentlocation or a slice of HistoryRodentlocation + // then run the AfterUpdateHooks on the slice + _, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryRodentlocationSlice) 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 HistoryRodentlocations.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 *HistoryRodentlocation: + o.copyMatchingRows(retrieved) + case []*HistoryRodentlocation: + o.copyMatchingRows(retrieved...) + case HistoryRodentlocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryRodentlocation or a slice of HistoryRodentlocation + // then run the AfterDeleteHooks on the slice + _, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryRodentlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryRodentlocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryRodentlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryRodentlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryRodentlocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryRodentlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryRodentlocations.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 *HistoryRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyRodentlocation0 *HistoryRodentlocation, organization1 *Organization) (*HistoryRodentlocation, error) { + setter := &HistoryRodentlocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyRodentlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryRodentlocationOrganization0: %w", err) + } + + return historyRodentlocation0, nil +} + +func (historyRodentlocation0 *HistoryRodentlocation) 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 = attachHistoryRodentlocationOrganization0(ctx, exec, 1, historyRodentlocation0, organization1) + if err != nil { + return err + } + + historyRodentlocation0.R.Organization = organization1 + + organization1.R.HistoryRodentlocations = append(organization1.R.HistoryRodentlocations, historyRodentlocation0) + + return nil +} + +func (historyRodentlocation0 *HistoryRodentlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryRodentlocationOrganization0(ctx, exec, 1, historyRodentlocation0, organization1) + if err != nil { + return err + } + + historyRodentlocation0.R.Organization = organization1 + + organization1.R.HistoryRodentlocations = append(organization1.R.HistoryRodentlocations, historyRodentlocation0) + + return nil +} + +type historyRodentlocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Lastinspectaction psql.WhereNullMod[Q, string] + Lastinspectconditions psql.WhereNullMod[Q, string] + Lastinspectdate psql.WhereNullMod[Q, int64] + Lastinspectrodentevidence psql.WhereNullMod[Q, string] + Lastinspectspecies psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Symbology psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyRodentlocationWhere[Q]) AliasedAs(alias string) historyRodentlocationWhere[Q] { + return buildHistoryRodentlocationWhere[Q](buildHistoryRodentlocationColumns(alias)) +} + +func buildHistoryRodentlocationWhere[Q psql.Filterable](cols historyRodentlocationColumns) historyRodentlocationWhere[Q] { + return historyRodentlocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Lastinspectaction: psql.WhereNull[Q, string](cols.Lastinspectaction), + Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), + Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), + Lastinspectrodentevidence: psql.WhereNull[Q, string](cols.Lastinspectrodentevidence), + Lastinspectspecies: psql.WhereNull[Q, string](cols.Lastinspectspecies), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryRodentlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyRodentlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryRodentlocations = HistoryRodentlocationSlice{o} + } + return nil + default: + return fmt.Errorf("historyRodentlocation has no relationship %q", name) + } +} + +type historyRodentlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryRodentlocationPreloader() historyRodentlocationPreloader { + return historyRodentlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryRodentlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyRodentlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryRodentlocationThenLoader[Q orm.Loadable]() historyRodentlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyRodentlocationThenLoader[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 historyRodentlocation's Organization into the .R struct +func (o *HistoryRodentlocation) 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.HistoryRodentlocations = HistoryRodentlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyRodentlocation's Organization into the .R struct +func (os HistoryRodentlocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryRodentlocations = append(rel.R.HistoryRodentlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyRodentlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyRodentlocationJoins[Q]) aliasedAs(alias string) historyRodentlocationJoins[Q] { + return buildHistoryRodentlocationJoins[Q](buildHistoryRodentlocationColumns(alias), j.typ) +} + +func buildHistoryRodentlocationJoins[Q dialect.Joinable](cols historyRodentlocationColumns, typ string) historyRodentlocationJoins[Q] { + return historyRodentlocationJoins[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/history_samplecollection.bob.go b/models/history_samplecollection.bob.go new file mode 100644 index 00000000..2575444c --- /dev/null +++ b/models/history_samplecollection.bob.go @@ -0,0 +1,1817 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historySamplecollectionR `db:"-" ` +} + +// HistorySamplecollectionSlice is an alias for a slice of pointers to HistorySamplecollection. +// This should almost always be used instead of []*HistorySamplecollection. +type HistorySamplecollectionSlice []*HistorySamplecollection + +// HistorySamplecollections contains methods to work with the history_samplecollection table +var HistorySamplecollections = psql.NewTablex[*HistorySamplecollection, HistorySamplecollectionSlice, *HistorySamplecollectionSetter]("", "history_samplecollection", buildHistorySamplecollectionColumns("history_samplecollection")) + +// HistorySamplecollectionsQuery is a query on the history_samplecollection table +type HistorySamplecollectionsQuery = *psql.ViewQuery[*HistorySamplecollection, HistorySamplecollectionSlice] + +// historySamplecollectionR is where relationships are stored. +type historySamplecollectionR struct { + Organization *Organization // history_samplecollection.history_samplecollection_organization_id_fkey +} + +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", + ).WithParent("history_samplecollection"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Avetemp: psql.Quote(alias, "avetemp"), + Chickenid: psql.Quote(alias, "chickenid"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datesent: psql.Quote(alias, "datesent"), + Datetested: psql.Quote(alias, "datetested"), + Diseasepos: psql.Quote(alias, "diseasepos"), + Diseasetested: psql.Quote(alias, "diseasetested"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Flockid: psql.Quote(alias, "flockid"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Lab: psql.Quote(alias, "lab"), + Locationname: psql.Quote(alias, "locationname"), + LocID: psql.Quote(alias, "loc_id"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Samplecond: psql.Quote(alias, "samplecond"), + Samplecount: psql.Quote(alias, "samplecount"), + Sampleid: psql.Quote(alias, "sampleid"), + Sampletype: psql.Quote(alias, "sampletype"), + Sex: psql.Quote(alias, "sex"), + Sitecond: psql.Quote(alias, "sitecond"), + Species: psql.Quote(alias, "species"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Survtech: psql.Quote(alias, "survtech"), + Testmethod: psql.Quote(alias, "testmethod"), + Testtech: psql.Quote(alias, "testtech"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historySamplecollectionColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Avetemp psql.Expression + Chickenid psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datesent psql.Expression + Datetested psql.Expression + Diseasepos psql.Expression + Diseasetested psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Flockid psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Lab psql.Expression + Locationname psql.Expression + LocID psql.Expression + Objectid psql.Expression + Processed psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Samplecond psql.Expression + Samplecount psql.Expression + Sampleid psql.Expression + Sampletype psql.Expression + Sex psql.Expression + Sitecond psql.Expression + Species psql.Expression + Startdatetime psql.Expression + Survtech psql.Expression + Testmethod psql.Expression + Testtech psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historySamplecollectionColumns) Alias() string { + return c.tableAlias +} + +func (historySamplecollectionColumns) AliasedAs(alias string) historySamplecollectionColumns { + return buildHistorySamplecollectionColumns(alias) +} + +// HistorySamplecollectionSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistorySamplecollectionSetter) SetColumns() []string { + vals := make([]string, 0, 50) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Chickenid.IsUnset() { + vals = append(vals, "chickenid") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datesent.IsUnset() { + vals = append(vals, "datesent") + } + if !s.Datetested.IsUnset() { + vals = append(vals, "datetested") + } + if !s.Diseasepos.IsUnset() { + vals = append(vals, "diseasepos") + } + if !s.Diseasetested.IsUnset() { + vals = append(vals, "diseasetested") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Flockid.IsUnset() { + vals = append(vals, "flockid") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lab.IsUnset() { + vals = append(vals, "lab") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LocID.IsUnset() { + vals = append(vals, "loc_id") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Samplecond.IsUnset() { + vals = append(vals, "samplecond") + } + if !s.Samplecount.IsUnset() { + vals = append(vals, "samplecount") + } + if !s.Sampleid.IsUnset() { + vals = append(vals, "sampleid") + } + if !s.Sampletype.IsUnset() { + vals = append(vals, "sampletype") + } + if !s.Sex.IsUnset() { + vals = append(vals, "sex") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Survtech.IsUnset() { + vals = append(vals, "survtech") + } + if !s.Testmethod.IsUnset() { + vals = append(vals, "testmethod") + } + if !s.Testtech.IsUnset() { + vals = append(vals, "testtech") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistorySamplecollectionSetter) Overwrite(t *HistorySamplecollection) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Chickenid.IsUnset() { + t.Chickenid = s.Chickenid.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datesent.IsUnset() { + t.Datesent = s.Datesent.MustGetNull() + } + if !s.Datetested.IsUnset() { + t.Datetested = s.Datetested.MustGetNull() + } + if !s.Diseasepos.IsUnset() { + t.Diseasepos = s.Diseasepos.MustGetNull() + } + if !s.Diseasetested.IsUnset() { + t.Diseasetested = s.Diseasetested.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Flockid.IsUnset() { + t.Flockid = s.Flockid.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lab.IsUnset() { + t.Lab = s.Lab.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LocID.IsUnset() { + t.LocID = s.LocID.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Samplecond.IsUnset() { + t.Samplecond = s.Samplecond.MustGetNull() + } + if !s.Samplecount.IsUnset() { + t.Samplecount = s.Samplecount.MustGetNull() + } + if !s.Sampleid.IsUnset() { + t.Sampleid = s.Sampleid.MustGetNull() + } + if !s.Sampletype.IsUnset() { + t.Sampletype = s.Sampletype.MustGetNull() + } + if !s.Sex.IsUnset() { + t.Sex = s.Sex.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Survtech.IsUnset() { + t.Survtech = s.Survtech.MustGetNull() + } + if !s.Testmethod.IsUnset() { + t.Testmethod = s.Testmethod.MustGetNull() + } + if !s.Testtech.IsUnset() { + t.Testtech = s.Testtech.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistorySamplecollectionSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistorySamplecollections.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, 50) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[2] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Chickenid.IsUnset() { + vals[3] = psql.Arg(s.Chickenid.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[4] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[5] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[6] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Datesent.IsUnset() { + vals[7] = psql.Arg(s.Datesent.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Datetested.IsUnset() { + vals[8] = psql.Arg(s.Datetested.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Diseasepos.IsUnset() { + vals[9] = psql.Arg(s.Diseasepos.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Diseasetested.IsUnset() { + vals[10] = psql.Arg(s.Diseasetested.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[11] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[12] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[13] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Flockid.IsUnset() { + vals[15] = psql.Arg(s.Flockid.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[16] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[17] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Lab.IsUnset() { + vals[18] = psql.Arg(s.Lab.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[19] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LocID.IsUnset() { + vals[20] = psql.Arg(s.LocID.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[21] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[22] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[23] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[24] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[25] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[26] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[27] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Samplecond.IsUnset() { + vals[28] = psql.Arg(s.Samplecond.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Samplecount.IsUnset() { + vals[29] = psql.Arg(s.Samplecount.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Sampleid.IsUnset() { + vals[30] = psql.Arg(s.Sampleid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Sampletype.IsUnset() { + vals[31] = psql.Arg(s.Sampletype.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Sex.IsUnset() { + vals[32] = psql.Arg(s.Sex.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[33] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[34] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[35] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Survtech.IsUnset() { + vals[36] = psql.Arg(s.Survtech.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Testmethod.IsUnset() { + vals[37] = psql.Arg(s.Testmethod.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Testtech.IsUnset() { + vals[38] = psql.Arg(s.Testtech.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[39] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[40] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[41] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[42] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[43] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[44] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[45] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[46] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[47] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[48] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[49] = psql.Arg(s.Version.MustGet()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistorySamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistorySamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 50) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Chickenid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "chickenid")...), + psql.Arg(s.Chickenid), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datesent.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datesent")...), + psql.Arg(s.Datesent), + }}) + } + + if !s.Datetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetested")...), + psql.Arg(s.Datetested), + }}) + } + + if !s.Diseasepos.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasepos")...), + psql.Arg(s.Diseasepos), + }}) + } + + if !s.Diseasetested.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "diseasetested")...), + psql.Arg(s.Diseasetested), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Flockid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flockid")...), + psql.Arg(s.Flockid), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lab.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lab")...), + psql.Arg(s.Lab), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LocID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "loc_id")...), + psql.Arg(s.LocID), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Samplecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplecond")...), + psql.Arg(s.Samplecond), + }}) + } + + if !s.Samplecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplecount")...), + psql.Arg(s.Samplecount), + }}) + } + + if !s.Sampleid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampleid")...), + psql.Arg(s.Sampleid), + }}) + } + + if !s.Sampletype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sampletype")...), + psql.Arg(s.Sampletype), + }}) + } + + if !s.Sex.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sex")...), + psql.Arg(s.Sex), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Survtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "survtech")...), + psql.Arg(s.Survtech), + }}) + } + + if !s.Testmethod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testmethod")...), + psql.Arg(s.Testmethod), + }}) + } + + if !s.Testtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "testtech")...), + psql.Arg(s.Testtech), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistorySamplecollection retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistorySamplecollection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySamplecollection, error) { + if len(cols) == 0 { + return HistorySamplecollections.Query( + sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistorySamplecollections.Query( + sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistorySamplecollections.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistorySamplecollectionExists checks the presence of a single record by primary key +func HistorySamplecollectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistorySamplecollections.Query( + sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistorySamplecollection is retrieved from the database +func (o *HistorySamplecollection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySamplecollections.AfterSelectHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistorySamplecollections.AfterInsertHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistorySamplecollection +func (o *HistorySamplecollection) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistorySamplecollection) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_samplecollection", "objectid"), psql.Quote("history_samplecollection", "version")).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 HistorySamplecollection +func (o *HistorySamplecollection) Update(ctx context.Context, exec bob.Executor, s *HistorySamplecollectionSetter) error { + v, err := HistorySamplecollections.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 HistorySamplecollection record with an executor +func (o *HistorySamplecollection) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistorySamplecollections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistorySamplecollection using the executor +func (o *HistorySamplecollection) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistorySamplecollections.Query( + sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistorySamplecollectionSlice is retrieved from the database +func (o HistorySamplecollectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySamplecollections.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistorySamplecollections.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistorySamplecollectionSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_samplecollection", "objectid"), psql.Quote("history_samplecollection", "version")).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 HistorySamplecollectionSlice) copyMatchingRows(from ...*HistorySamplecollection) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistorySamplecollectionSlice) 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 HistorySamplecollections.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 *HistorySamplecollection: + o.copyMatchingRows(retrieved) + case []*HistorySamplecollection: + o.copyMatchingRows(retrieved...) + case HistorySamplecollectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySamplecollection or a slice of HistorySamplecollection + // then run the AfterUpdateHooks on the slice + _, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistorySamplecollectionSlice) 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 HistorySamplecollections.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 *HistorySamplecollection: + o.copyMatchingRows(retrieved) + case []*HistorySamplecollection: + o.copyMatchingRows(retrieved...) + case HistorySamplecollectionSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySamplecollection or a slice of HistorySamplecollection + // then run the AfterDeleteHooks on the slice + _, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistorySamplecollectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySamplecollectionSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySamplecollections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistorySamplecollectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySamplecollections.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistorySamplecollectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistorySamplecollections.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 *HistorySamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistorySamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistorySamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplecollection0 *HistorySamplecollection, organization1 *Organization) (*HistorySamplecollection, error) { + setter := &HistorySamplecollectionSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historySamplecollection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistorySamplecollectionOrganization0: %w", err) + } + + return historySamplecollection0, nil +} + +func (historySamplecollection0 *HistorySamplecollection) 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 = attachHistorySamplecollectionOrganization0(ctx, exec, 1, historySamplecollection0, organization1) + if err != nil { + return err + } + + historySamplecollection0.R.Organization = organization1 + + organization1.R.HistorySamplecollections = append(organization1.R.HistorySamplecollections, historySamplecollection0) + + return nil +} + +func (historySamplecollection0 *HistorySamplecollection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistorySamplecollectionOrganization0(ctx, exec, 1, historySamplecollection0, organization1) + if err != nil { + return err + } + + historySamplecollection0.R.Organization = organization1 + + organization1.R.HistorySamplecollections = append(organization1.R.HistorySamplecollections, historySamplecollection0) + + return nil +} + +type historySamplecollectionWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Chickenid psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datesent psql.WhereNullMod[Q, int64] + Datetested psql.WhereNullMod[Q, int64] + Diseasepos psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Flockid psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Lab psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LocID psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Samplecond psql.WhereNullMod[Q, string] + Samplecount psql.WhereNullMod[Q, int16] + Sampleid psql.WhereNullMod[Q, string] + Sampletype psql.WhereNullMod[Q, string] + Sex psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Species psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Survtech psql.WhereNullMod[Q, string] + Testmethod psql.WhereNullMod[Q, string] + Testtech psql.WhereNullMod[Q, string] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historySamplecollectionWhere[Q]) AliasedAs(alias string) historySamplecollectionWhere[Q] { + return buildHistorySamplecollectionWhere[Q](buildHistorySamplecollectionColumns(alias)) +} + +func buildHistorySamplecollectionWhere[Q psql.Filterable](cols historySamplecollectionColumns) historySamplecollectionWhere[Q] { + return historySamplecollectionWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Datesent: psql.WhereNull[Q, int64](cols.Datesent), + Datetested: psql.WhereNull[Q, int64](cols.Datetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Flockid: psql.WhereNull[Q, string](cols.Flockid), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lab: psql.WhereNull[Q, string](cols.Lab), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LocID: psql.WhereNull[Q, string](cols.LocID), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Samplecond: psql.WhereNull[Q, string](cols.Samplecond), + Samplecount: psql.WhereNull[Q, int16](cols.Samplecount), + Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + Sampletype: psql.WhereNull[Q, string](cols.Sampletype), + Sex: psql.WhereNull[Q, string](cols.Sex), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Species: psql.WhereNull[Q, string](cols.Species), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Survtech: psql.WhereNull[Q, string](cols.Survtech), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Testtech: psql.WhereNull[Q, string](cols.Testtech), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistorySamplecollection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historySamplecollection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistorySamplecollections = HistorySamplecollectionSlice{o} + } + return nil + default: + return fmt.Errorf("historySamplecollection has no relationship %q", name) + } +} + +type historySamplecollectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistorySamplecollectionPreloader() historySamplecollectionPreloader { + return historySamplecollectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistorySamplecollections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historySamplecollectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistorySamplecollectionThenLoader[Q orm.Loadable]() historySamplecollectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historySamplecollectionThenLoader[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 historySamplecollection's Organization into the .R struct +func (o *HistorySamplecollection) 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.HistorySamplecollections = HistorySamplecollectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historySamplecollection's Organization into the .R struct +func (os HistorySamplecollectionSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistorySamplecollections = append(rel.R.HistorySamplecollections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historySamplecollectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historySamplecollectionJoins[Q]) aliasedAs(alias string) historySamplecollectionJoins[Q] { + return buildHistorySamplecollectionJoins[Q](buildHistorySamplecollectionColumns(alias), j.typ) +} + +func buildHistorySamplecollectionJoins[Q dialect.Joinable](cols historySamplecollectionColumns, typ string) historySamplecollectionJoins[Q] { + return historySamplecollectionJoins[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/history_samplelocation.bob.go b/models/history_samplelocation.bob.go new file mode 100644 index 00000000..555a7f59 --- /dev/null +++ b/models/history_samplelocation.bob.go @@ -0,0 +1,1267 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historySamplelocationR `db:"-" ` +} + +// HistorySamplelocationSlice is an alias for a slice of pointers to HistorySamplelocation. +// This should almost always be used instead of []*HistorySamplelocation. +type HistorySamplelocationSlice []*HistorySamplelocation + +// HistorySamplelocations contains methods to work with the history_samplelocation table +var HistorySamplelocations = psql.NewTablex[*HistorySamplelocation, HistorySamplelocationSlice, *HistorySamplelocationSetter]("", "history_samplelocation", buildHistorySamplelocationColumns("history_samplelocation")) + +// HistorySamplelocationsQuery is a query on the history_samplelocation table +type HistorySamplelocationsQuery = *psql.ViewQuery[*HistorySamplelocation, HistorySamplelocationSlice] + +// historySamplelocationR is where relationships are stored. +type historySamplelocationR struct { + Organization *Organization // history_samplelocation.history_samplelocation_organization_id_fkey +} + +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", + ).WithParent("history_samplelocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historySamplelocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historySamplelocationColumns) Alias() string { + return c.tableAlias +} + +func (historySamplelocationColumns) AliasedAs(alias string) historySamplelocationColumns { + return buildHistorySamplelocationColumns(alias) +} + +// HistorySamplelocationSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistorySamplelocationSetter) SetColumns() []string { + vals := make([]string, 0, 28) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistorySamplelocationSetter) Overwrite(t *HistorySamplelocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistorySamplelocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistorySamplelocations.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, 28) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[14] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[17] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[18] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[19] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[20] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[27] = psql.Arg(s.Version.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistorySamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistorySamplelocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 28) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistorySamplelocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistorySamplelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySamplelocation, error) { + if len(cols) == 0 { + return HistorySamplelocations.Query( + sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistorySamplelocations.Query( + sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistorySamplelocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistorySamplelocationExists checks the presence of a single record by primary key +func HistorySamplelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistorySamplelocations.Query( + sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistorySamplelocation is retrieved from the database +func (o *HistorySamplelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySamplelocations.AfterSelectHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistorySamplelocations.AfterInsertHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistorySamplelocation +func (o *HistorySamplelocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistorySamplelocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_samplelocation", "objectid"), psql.Quote("history_samplelocation", "version")).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 HistorySamplelocation +func (o *HistorySamplelocation) Update(ctx context.Context, exec bob.Executor, s *HistorySamplelocationSetter) error { + v, err := HistorySamplelocations.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 HistorySamplelocation record with an executor +func (o *HistorySamplelocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistorySamplelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistorySamplelocation using the executor +func (o *HistorySamplelocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistorySamplelocations.Query( + sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistorySamplelocationSlice is retrieved from the database +func (o HistorySamplelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySamplelocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistorySamplelocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistorySamplelocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_samplelocation", "objectid"), psql.Quote("history_samplelocation", "version")).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 HistorySamplelocationSlice) copyMatchingRows(from ...*HistorySamplelocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistorySamplelocationSlice) 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 HistorySamplelocations.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 *HistorySamplelocation: + o.copyMatchingRows(retrieved) + case []*HistorySamplelocation: + o.copyMatchingRows(retrieved...) + case HistorySamplelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySamplelocation or a slice of HistorySamplelocation + // then run the AfterUpdateHooks on the slice + _, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistorySamplelocationSlice) 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 HistorySamplelocations.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 *HistorySamplelocation: + o.copyMatchingRows(retrieved) + case []*HistorySamplelocation: + o.copyMatchingRows(retrieved...) + case HistorySamplelocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySamplelocation or a slice of HistorySamplelocation + // then run the AfterDeleteHooks on the slice + _, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistorySamplelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySamplelocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySamplelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistorySamplelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySamplelocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistorySamplelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistorySamplelocations.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 *HistorySamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistorySamplelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistorySamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplelocation0 *HistorySamplelocation, organization1 *Organization) (*HistorySamplelocation, error) { + setter := &HistorySamplelocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historySamplelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistorySamplelocationOrganization0: %w", err) + } + + return historySamplelocation0, nil +} + +func (historySamplelocation0 *HistorySamplelocation) 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 = attachHistorySamplelocationOrganization0(ctx, exec, 1, historySamplelocation0, organization1) + if err != nil { + return err + } + + historySamplelocation0.R.Organization = organization1 + + organization1.R.HistorySamplelocations = append(organization1.R.HistorySamplelocations, historySamplelocation0) + + return nil +} + +func (historySamplelocation0 *HistorySamplelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistorySamplelocationOrganization0(ctx, exec, 1, historySamplelocation0, organization1) + if err != nil { + return err + } + + historySamplelocation0.R.Organization = organization1 + + organization1.R.HistorySamplelocations = append(organization1.R.HistorySamplelocations, historySamplelocation0) + + return nil +} + +type historySamplelocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historySamplelocationWhere[Q]) AliasedAs(alias string) historySamplelocationWhere[Q] { + return buildHistorySamplelocationWhere[Q](buildHistorySamplelocationColumns(alias)) +} + +func buildHistorySamplelocationWhere[Q psql.Filterable](cols historySamplelocationColumns) historySamplelocationWhere[Q] { + return historySamplelocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistorySamplelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historySamplelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistorySamplelocations = HistorySamplelocationSlice{o} + } + return nil + default: + return fmt.Errorf("historySamplelocation has no relationship %q", name) + } +} + +type historySamplelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistorySamplelocationPreloader() historySamplelocationPreloader { + return historySamplelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistorySamplelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historySamplelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistorySamplelocationThenLoader[Q orm.Loadable]() historySamplelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historySamplelocationThenLoader[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 historySamplelocation's Organization into the .R struct +func (o *HistorySamplelocation) 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.HistorySamplelocations = HistorySamplelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historySamplelocation's Organization into the .R struct +func (os HistorySamplelocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistorySamplelocations = append(rel.R.HistorySamplelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historySamplelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historySamplelocationJoins[Q]) aliasedAs(alias string) historySamplelocationJoins[Q] { + return buildHistorySamplelocationJoins[Q](buildHistorySamplelocationColumns(alias), j.typ) +} + +func buildHistorySamplelocationJoins[Q dialect.Joinable](cols historySamplelocationColumns, typ string) historySamplelocationJoins[Q] { + return historySamplelocationJoins[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/history_servicerequest.bob.go b/models/history_servicerequest.bob.go new file mode 100644 index 00000000..741100cc --- /dev/null +++ b/models/history_servicerequest.bob.go @@ -0,0 +1,2817 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyServicerequestR `db:"-" ` +} + +// HistoryServicerequestSlice is an alias for a slice of pointers to HistoryServicerequest. +// This should almost always be used instead of []*HistoryServicerequest. +type HistoryServicerequestSlice []*HistoryServicerequest + +// HistoryServicerequests contains methods to work with the history_servicerequest table +var HistoryServicerequests = psql.NewTablex[*HistoryServicerequest, HistoryServicerequestSlice, *HistoryServicerequestSetter]("", "history_servicerequest", buildHistoryServicerequestColumns("history_servicerequest")) + +// HistoryServicerequestsQuery is a query on the history_servicerequest table +type HistoryServicerequestsQuery = *psql.ViewQuery[*HistoryServicerequest, HistoryServicerequestSlice] + +// historyServicerequestR is where relationships are stored. +type historyServicerequestR struct { + Organization *Organization // history_servicerequest.history_servicerequest_organization_id_fkey +} + +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", + ).WithParent("history_servicerequest"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accepted: psql.Quote(alias, "accepted"), + Acceptedby: psql.Quote(alias, "acceptedby"), + Accepteddate: psql.Quote(alias, "accepteddate"), + Allowed: psql.Quote(alias, "allowed"), + Assignedtech: psql.Quote(alias, "assignedtech"), + Clraddr1: psql.Quote(alias, "clraddr1"), + Clraddr2: psql.Quote(alias, "clraddr2"), + Clranon: psql.Quote(alias, "clranon"), + Clrcity: psql.Quote(alias, "clrcity"), + Clrcompany: psql.Quote(alias, "clrcompany"), + Clrcontpref: psql.Quote(alias, "clrcontpref"), + Clremail: psql.Quote(alias, "clremail"), + Clrfname: psql.Quote(alias, "clrfname"), + Clrother: psql.Quote(alias, "clrother"), + Clrphone1: psql.Quote(alias, "clrphone1"), + Clrphone2: psql.Quote(alias, "clrphone2"), + Clrstate: psql.Quote(alias, "clrstate"), + Clrzip: psql.Quote(alias, "clrzip"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Datetimeclosed: psql.Quote(alias, "datetimeclosed"), + Duedate: psql.Quote(alias, "duedate"), + Entrytech: psql.Quote(alias, "entrytech"), + Estcompletedate: psql.Quote(alias, "estcompletedate"), + Externalerror: psql.Quote(alias, "externalerror"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Firstresponsedate: psql.Quote(alias, "firstresponsedate"), + Globalid: psql.Quote(alias, "globalid"), + Issuesreported: psql.Quote(alias, "issuesreported"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Nextaction: psql.Quote(alias, "nextaction"), + Notificationtimestamp: psql.Quote(alias, "notificationtimestamp"), + Notified: psql.Quote(alias, "notified"), + Notifieddate: psql.Quote(alias, "notifieddate"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Priority: psql.Quote(alias, "priority"), + Recdatetime: psql.Quote(alias, "recdatetime"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Rejectedby: psql.Quote(alias, "rejectedby"), + Rejecteddate: psql.Quote(alias, "rejecteddate"), + Rejectedreason: psql.Quote(alias, "rejectedreason"), + Reqaddr1: psql.Quote(alias, "reqaddr1"), + Reqaddr2: psql.Quote(alias, "reqaddr2"), + Reqcity: psql.Quote(alias, "reqcity"), + Reqcompany: psql.Quote(alias, "reqcompany"), + Reqcrossst: psql.Quote(alias, "reqcrossst"), + Reqdescr: psql.Quote(alias, "reqdescr"), + Reqfldnotes: psql.Quote(alias, "reqfldnotes"), + Reqmapgrid: psql.Quote(alias, "reqmapgrid"), + Reqnotesforcust: psql.Quote(alias, "reqnotesforcust"), + Reqnotesfortech: psql.Quote(alias, "reqnotesfortech"), + Reqpermission: psql.Quote(alias, "reqpermission"), + Reqprogramactions: psql.Quote(alias, "reqprogramactions"), + Reqstate: psql.Quote(alias, "reqstate"), + Reqsubdiv: psql.Quote(alias, "reqsubdiv"), + Reqtarget: psql.Quote(alias, "reqtarget"), + Reqzip: psql.Quote(alias, "reqzip"), + Responsedaycount: psql.Quote(alias, "responsedaycount"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Scheduled: psql.Quote(alias, "scheduled"), + Scheduleddate: psql.Quote(alias, "scheduleddate"), + Source: psql.Quote(alias, "source"), + SRNumber: psql.Quote(alias, "sr_number"), + Status: psql.Quote(alias, "status"), + Supervisor: psql.Quote(alias, "supervisor"), + Techclosed: psql.Quote(alias, "techclosed"), + Validx: psql.Quote(alias, "validx"), + Validy: psql.Quote(alias, "validy"), + Xvalue: psql.Quote(alias, "xvalue"), + Yvalue: psql.Quote(alias, "yvalue"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Dog: psql.Quote(alias, "dog"), + Spanish: psql.Quote(alias, "spanish"), + ScheduleNotes: psql.Quote(alias, "schedule_notes"), + SchedulePeriod: psql.Quote(alias, "schedule_period"), + Version: psql.Quote(alias, "version"), + } +} + +type historyServicerequestColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accepted psql.Expression + Acceptedby psql.Expression + Accepteddate psql.Expression + Allowed psql.Expression + Assignedtech psql.Expression + Clraddr1 psql.Expression + Clraddr2 psql.Expression + Clranon psql.Expression + Clrcity psql.Expression + Clrcompany psql.Expression + Clrcontpref psql.Expression + Clremail psql.Expression + Clrfname psql.Expression + Clrother psql.Expression + Clrphone1 psql.Expression + Clrphone2 psql.Expression + Clrstate psql.Expression + Clrzip psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Datetimeclosed psql.Expression + Duedate psql.Expression + Entrytech psql.Expression + Estcompletedate psql.Expression + Externalerror psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Firstresponsedate psql.Expression + Globalid psql.Expression + Issuesreported psql.Expression + Jurisdiction psql.Expression + Nextaction psql.Expression + Notificationtimestamp psql.Expression + Notified psql.Expression + Notifieddate psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Priority psql.Expression + Recdatetime psql.Expression + Recordstatus psql.Expression + Rejectedby psql.Expression + Rejecteddate psql.Expression + Rejectedreason psql.Expression + Reqaddr1 psql.Expression + Reqaddr2 psql.Expression + Reqcity psql.Expression + Reqcompany psql.Expression + Reqcrossst psql.Expression + Reqdescr psql.Expression + Reqfldnotes psql.Expression + Reqmapgrid psql.Expression + Reqnotesforcust psql.Expression + Reqnotesfortech psql.Expression + Reqpermission psql.Expression + Reqprogramactions psql.Expression + Reqstate psql.Expression + Reqsubdiv psql.Expression + Reqtarget psql.Expression + Reqzip psql.Expression + Responsedaycount psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Scheduled psql.Expression + Scheduleddate psql.Expression + Source psql.Expression + SRNumber psql.Expression + Status psql.Expression + Supervisor psql.Expression + Techclosed psql.Expression + Validx psql.Expression + Validy psql.Expression + Xvalue psql.Expression + Yvalue psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Dog psql.Expression + Spanish psql.Expression + ScheduleNotes psql.Expression + SchedulePeriod psql.Expression + Version psql.Expression +} + +func (c historyServicerequestColumns) Alias() string { + return c.tableAlias +} + +func (historyServicerequestColumns) AliasedAs(alias string) historyServicerequestColumns { + return buildHistoryServicerequestColumns(alias) +} + +// HistoryServicerequestSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryServicerequestSetter) SetColumns() []string { + vals := make([]string, 0, 90) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accepted.IsUnset() { + vals = append(vals, "accepted") + } + if !s.Acceptedby.IsUnset() { + vals = append(vals, "acceptedby") + } + if !s.Accepteddate.IsUnset() { + vals = append(vals, "accepteddate") + } + if !s.Allowed.IsUnset() { + vals = append(vals, "allowed") + } + if !s.Assignedtech.IsUnset() { + vals = append(vals, "assignedtech") + } + if !s.Clraddr1.IsUnset() { + vals = append(vals, "clraddr1") + } + if !s.Clraddr2.IsUnset() { + vals = append(vals, "clraddr2") + } + if !s.Clranon.IsUnset() { + vals = append(vals, "clranon") + } + if !s.Clrcity.IsUnset() { + vals = append(vals, "clrcity") + } + if !s.Clrcompany.IsUnset() { + vals = append(vals, "clrcompany") + } + if !s.Clrcontpref.IsUnset() { + vals = append(vals, "clrcontpref") + } + if !s.Clremail.IsUnset() { + vals = append(vals, "clremail") + } + if !s.Clrfname.IsUnset() { + vals = append(vals, "clrfname") + } + if !s.Clrother.IsUnset() { + vals = append(vals, "clrother") + } + if !s.Clrphone1.IsUnset() { + vals = append(vals, "clrphone1") + } + if !s.Clrphone2.IsUnset() { + vals = append(vals, "clrphone2") + } + if !s.Clrstate.IsUnset() { + vals = append(vals, "clrstate") + } + if !s.Clrzip.IsUnset() { + vals = append(vals, "clrzip") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Datetimeclosed.IsUnset() { + vals = append(vals, "datetimeclosed") + } + if !s.Duedate.IsUnset() { + vals = append(vals, "duedate") + } + if !s.Entrytech.IsUnset() { + vals = append(vals, "entrytech") + } + if !s.Estcompletedate.IsUnset() { + vals = append(vals, "estcompletedate") + } + if !s.Externalerror.IsUnset() { + vals = append(vals, "externalerror") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Firstresponsedate.IsUnset() { + vals = append(vals, "firstresponsedate") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Issuesreported.IsUnset() { + vals = append(vals, "issuesreported") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Nextaction.IsUnset() { + vals = append(vals, "nextaction") + } + if !s.Notificationtimestamp.IsUnset() { + vals = append(vals, "notificationtimestamp") + } + if !s.Notified.IsUnset() { + vals = append(vals, "notified") + } + if !s.Notifieddate.IsUnset() { + vals = append(vals, "notifieddate") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Recdatetime.IsUnset() { + vals = append(vals, "recdatetime") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Rejectedby.IsUnset() { + vals = append(vals, "rejectedby") + } + if !s.Rejecteddate.IsUnset() { + vals = append(vals, "rejecteddate") + } + if !s.Rejectedreason.IsUnset() { + vals = append(vals, "rejectedreason") + } + if !s.Reqaddr1.IsUnset() { + vals = append(vals, "reqaddr1") + } + if !s.Reqaddr2.IsUnset() { + vals = append(vals, "reqaddr2") + } + if !s.Reqcity.IsUnset() { + vals = append(vals, "reqcity") + } + if !s.Reqcompany.IsUnset() { + vals = append(vals, "reqcompany") + } + if !s.Reqcrossst.IsUnset() { + vals = append(vals, "reqcrossst") + } + if !s.Reqdescr.IsUnset() { + vals = append(vals, "reqdescr") + } + if !s.Reqfldnotes.IsUnset() { + vals = append(vals, "reqfldnotes") + } + if !s.Reqmapgrid.IsUnset() { + vals = append(vals, "reqmapgrid") + } + if !s.Reqnotesforcust.IsUnset() { + vals = append(vals, "reqnotesforcust") + } + if !s.Reqnotesfortech.IsUnset() { + vals = append(vals, "reqnotesfortech") + } + if !s.Reqpermission.IsUnset() { + vals = append(vals, "reqpermission") + } + if !s.Reqprogramactions.IsUnset() { + vals = append(vals, "reqprogramactions") + } + if !s.Reqstate.IsUnset() { + vals = append(vals, "reqstate") + } + if !s.Reqsubdiv.IsUnset() { + vals = append(vals, "reqsubdiv") + } + if !s.Reqtarget.IsUnset() { + vals = append(vals, "reqtarget") + } + if !s.Reqzip.IsUnset() { + vals = append(vals, "reqzip") + } + if !s.Responsedaycount.IsUnset() { + vals = append(vals, "responsedaycount") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Scheduled.IsUnset() { + vals = append(vals, "scheduled") + } + if !s.Scheduleddate.IsUnset() { + vals = append(vals, "scheduleddate") + } + if !s.Source.IsUnset() { + vals = append(vals, "source") + } + if !s.SRNumber.IsUnset() { + vals = append(vals, "sr_number") + } + if !s.Status.IsUnset() { + vals = append(vals, "status") + } + if !s.Supervisor.IsUnset() { + vals = append(vals, "supervisor") + } + if !s.Techclosed.IsUnset() { + vals = append(vals, "techclosed") + } + if !s.Validx.IsUnset() { + vals = append(vals, "validx") + } + if !s.Validy.IsUnset() { + vals = append(vals, "validy") + } + if !s.Xvalue.IsUnset() { + vals = append(vals, "xvalue") + } + if !s.Yvalue.IsUnset() { + vals = append(vals, "yvalue") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Dog.IsUnset() { + vals = append(vals, "dog") + } + if !s.Spanish.IsUnset() { + vals = append(vals, "spanish") + } + if !s.ScheduleNotes.IsUnset() { + vals = append(vals, "schedule_notes") + } + if !s.SchedulePeriod.IsUnset() { + vals = append(vals, "schedule_period") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryServicerequestSetter) Overwrite(t *HistoryServicerequest) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accepted.IsUnset() { + t.Accepted = s.Accepted.MustGetNull() + } + if !s.Acceptedby.IsUnset() { + t.Acceptedby = s.Acceptedby.MustGetNull() + } + if !s.Accepteddate.IsUnset() { + t.Accepteddate = s.Accepteddate.MustGetNull() + } + if !s.Allowed.IsUnset() { + t.Allowed = s.Allowed.MustGetNull() + } + if !s.Assignedtech.IsUnset() { + t.Assignedtech = s.Assignedtech.MustGetNull() + } + if !s.Clraddr1.IsUnset() { + t.Clraddr1 = s.Clraddr1.MustGetNull() + } + if !s.Clraddr2.IsUnset() { + t.Clraddr2 = s.Clraddr2.MustGetNull() + } + if !s.Clranon.IsUnset() { + t.Clranon = s.Clranon.MustGetNull() + } + if !s.Clrcity.IsUnset() { + t.Clrcity = s.Clrcity.MustGetNull() + } + if !s.Clrcompany.IsUnset() { + t.Clrcompany = s.Clrcompany.MustGetNull() + } + if !s.Clrcontpref.IsUnset() { + t.Clrcontpref = s.Clrcontpref.MustGetNull() + } + if !s.Clremail.IsUnset() { + t.Clremail = s.Clremail.MustGetNull() + } + if !s.Clrfname.IsUnset() { + t.Clrfname = s.Clrfname.MustGetNull() + } + if !s.Clrother.IsUnset() { + t.Clrother = s.Clrother.MustGetNull() + } + if !s.Clrphone1.IsUnset() { + t.Clrphone1 = s.Clrphone1.MustGetNull() + } + if !s.Clrphone2.IsUnset() { + t.Clrphone2 = s.Clrphone2.MustGetNull() + } + if !s.Clrstate.IsUnset() { + t.Clrstate = s.Clrstate.MustGetNull() + } + if !s.Clrzip.IsUnset() { + t.Clrzip = s.Clrzip.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Datetimeclosed.IsUnset() { + t.Datetimeclosed = s.Datetimeclosed.MustGetNull() + } + if !s.Duedate.IsUnset() { + t.Duedate = s.Duedate.MustGetNull() + } + if !s.Entrytech.IsUnset() { + t.Entrytech = s.Entrytech.MustGetNull() + } + if !s.Estcompletedate.IsUnset() { + t.Estcompletedate = s.Estcompletedate.MustGetNull() + } + if !s.Externalerror.IsUnset() { + t.Externalerror = s.Externalerror.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Firstresponsedate.IsUnset() { + t.Firstresponsedate = s.Firstresponsedate.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Issuesreported.IsUnset() { + t.Issuesreported = s.Issuesreported.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Nextaction.IsUnset() { + t.Nextaction = s.Nextaction.MustGetNull() + } + if !s.Notificationtimestamp.IsUnset() { + t.Notificationtimestamp = s.Notificationtimestamp.MustGetNull() + } + if !s.Notified.IsUnset() { + t.Notified = s.Notified.MustGetNull() + } + if !s.Notifieddate.IsUnset() { + t.Notifieddate = s.Notifieddate.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Recdatetime.IsUnset() { + t.Recdatetime = s.Recdatetime.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Rejectedby.IsUnset() { + t.Rejectedby = s.Rejectedby.MustGetNull() + } + if !s.Rejecteddate.IsUnset() { + t.Rejecteddate = s.Rejecteddate.MustGetNull() + } + if !s.Rejectedreason.IsUnset() { + t.Rejectedreason = s.Rejectedreason.MustGetNull() + } + if !s.Reqaddr1.IsUnset() { + t.Reqaddr1 = s.Reqaddr1.MustGetNull() + } + if !s.Reqaddr2.IsUnset() { + t.Reqaddr2 = s.Reqaddr2.MustGetNull() + } + if !s.Reqcity.IsUnset() { + t.Reqcity = s.Reqcity.MustGetNull() + } + if !s.Reqcompany.IsUnset() { + t.Reqcompany = s.Reqcompany.MustGetNull() + } + if !s.Reqcrossst.IsUnset() { + t.Reqcrossst = s.Reqcrossst.MustGetNull() + } + if !s.Reqdescr.IsUnset() { + t.Reqdescr = s.Reqdescr.MustGetNull() + } + if !s.Reqfldnotes.IsUnset() { + t.Reqfldnotes = s.Reqfldnotes.MustGetNull() + } + if !s.Reqmapgrid.IsUnset() { + t.Reqmapgrid = s.Reqmapgrid.MustGetNull() + } + if !s.Reqnotesforcust.IsUnset() { + t.Reqnotesforcust = s.Reqnotesforcust.MustGetNull() + } + if !s.Reqnotesfortech.IsUnset() { + t.Reqnotesfortech = s.Reqnotesfortech.MustGetNull() + } + if !s.Reqpermission.IsUnset() { + t.Reqpermission = s.Reqpermission.MustGetNull() + } + if !s.Reqprogramactions.IsUnset() { + t.Reqprogramactions = s.Reqprogramactions.MustGetNull() + } + if !s.Reqstate.IsUnset() { + t.Reqstate = s.Reqstate.MustGetNull() + } + if !s.Reqsubdiv.IsUnset() { + t.Reqsubdiv = s.Reqsubdiv.MustGetNull() + } + if !s.Reqtarget.IsUnset() { + t.Reqtarget = s.Reqtarget.MustGetNull() + } + if !s.Reqzip.IsUnset() { + t.Reqzip = s.Reqzip.MustGetNull() + } + if !s.Responsedaycount.IsUnset() { + t.Responsedaycount = s.Responsedaycount.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Scheduled.IsUnset() { + t.Scheduled = s.Scheduled.MustGetNull() + } + if !s.Scheduleddate.IsUnset() { + t.Scheduleddate = s.Scheduleddate.MustGetNull() + } + if !s.Source.IsUnset() { + t.Source = s.Source.MustGetNull() + } + if !s.SRNumber.IsUnset() { + t.SRNumber = s.SRNumber.MustGetNull() + } + if !s.Status.IsUnset() { + t.Status = s.Status.MustGetNull() + } + if !s.Supervisor.IsUnset() { + t.Supervisor = s.Supervisor.MustGetNull() + } + if !s.Techclosed.IsUnset() { + t.Techclosed = s.Techclosed.MustGetNull() + } + if !s.Validx.IsUnset() { + t.Validx = s.Validx.MustGetNull() + } + if !s.Validy.IsUnset() { + t.Validy = s.Validy.MustGetNull() + } + if !s.Xvalue.IsUnset() { + t.Xvalue = s.Xvalue.MustGetNull() + } + if !s.Yvalue.IsUnset() { + t.Yvalue = s.Yvalue.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Dog.IsUnset() { + t.Dog = s.Dog.MustGetNull() + } + if !s.Spanish.IsUnset() { + t.Spanish = s.Spanish.MustGetNull() + } + if !s.ScheduleNotes.IsUnset() { + t.ScheduleNotes = s.ScheduleNotes.MustGetNull() + } + if !s.SchedulePeriod.IsUnset() { + t.SchedulePeriod = s.SchedulePeriod.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryServicerequestSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryServicerequests.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, 90) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accepted.IsUnset() { + vals[1] = psql.Arg(s.Accepted.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Acceptedby.IsUnset() { + vals[2] = psql.Arg(s.Acceptedby.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Accepteddate.IsUnset() { + vals[3] = psql.Arg(s.Accepteddate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Allowed.IsUnset() { + vals[4] = psql.Arg(s.Allowed.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Assignedtech.IsUnset() { + vals[5] = psql.Arg(s.Assignedtech.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Clraddr1.IsUnset() { + vals[6] = psql.Arg(s.Clraddr1.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Clraddr2.IsUnset() { + vals[7] = psql.Arg(s.Clraddr2.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Clranon.IsUnset() { + vals[8] = psql.Arg(s.Clranon.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Clrcity.IsUnset() { + vals[9] = psql.Arg(s.Clrcity.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Clrcompany.IsUnset() { + vals[10] = psql.Arg(s.Clrcompany.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Clrcontpref.IsUnset() { + vals[11] = psql.Arg(s.Clrcontpref.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Clremail.IsUnset() { + vals[12] = psql.Arg(s.Clremail.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Clrfname.IsUnset() { + vals[13] = psql.Arg(s.Clrfname.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Clrother.IsUnset() { + vals[14] = psql.Arg(s.Clrother.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Clrphone1.IsUnset() { + vals[15] = psql.Arg(s.Clrphone1.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Clrphone2.IsUnset() { + vals[16] = psql.Arg(s.Clrphone2.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Clrstate.IsUnset() { + vals[17] = psql.Arg(s.Clrstate.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Clrzip.IsUnset() { + vals[18] = psql.Arg(s.Clrzip.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[19] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[20] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[21] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Datetimeclosed.IsUnset() { + vals[22] = psql.Arg(s.Datetimeclosed.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Duedate.IsUnset() { + vals[23] = psql.Arg(s.Duedate.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Entrytech.IsUnset() { + vals[24] = psql.Arg(s.Entrytech.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Estcompletedate.IsUnset() { + vals[25] = psql.Arg(s.Estcompletedate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Externalerror.IsUnset() { + vals[26] = psql.Arg(s.Externalerror.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[27] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[28] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[29] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Firstresponsedate.IsUnset() { + vals[30] = psql.Arg(s.Firstresponsedate.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[31] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Issuesreported.IsUnset() { + vals[32] = psql.Arg(s.Issuesreported.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Nextaction.IsUnset() { + vals[34] = psql.Arg(s.Nextaction.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Notificationtimestamp.IsUnset() { + vals[35] = psql.Arg(s.Notificationtimestamp.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Notified.IsUnset() { + vals[36] = psql.Arg(s.Notified.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Notifieddate.IsUnset() { + vals[37] = psql.Arg(s.Notifieddate.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[38] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[39] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[40] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Recdatetime.IsUnset() { + vals[41] = psql.Arg(s.Recdatetime.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[42] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Rejectedby.IsUnset() { + vals[43] = psql.Arg(s.Rejectedby.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Rejecteddate.IsUnset() { + vals[44] = psql.Arg(s.Rejecteddate.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Rejectedreason.IsUnset() { + vals[45] = psql.Arg(s.Rejectedreason.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Reqaddr1.IsUnset() { + vals[46] = psql.Arg(s.Reqaddr1.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Reqaddr2.IsUnset() { + vals[47] = psql.Arg(s.Reqaddr2.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Reqcity.IsUnset() { + vals[48] = psql.Arg(s.Reqcity.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Reqcompany.IsUnset() { + vals[49] = psql.Arg(s.Reqcompany.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Reqcrossst.IsUnset() { + vals[50] = psql.Arg(s.Reqcrossst.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Reqdescr.IsUnset() { + vals[51] = psql.Arg(s.Reqdescr.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Reqfldnotes.IsUnset() { + vals[52] = psql.Arg(s.Reqfldnotes.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Reqmapgrid.IsUnset() { + vals[53] = psql.Arg(s.Reqmapgrid.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.Reqnotesforcust.IsUnset() { + vals[54] = psql.Arg(s.Reqnotesforcust.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.Reqnotesfortech.IsUnset() { + vals[55] = psql.Arg(s.Reqnotesfortech.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.Reqpermission.IsUnset() { + vals[56] = psql.Arg(s.Reqpermission.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if !s.Reqprogramactions.IsUnset() { + vals[57] = psql.Arg(s.Reqprogramactions.MustGetNull()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + if !s.Reqstate.IsUnset() { + vals[58] = psql.Arg(s.Reqstate.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if !s.Reqsubdiv.IsUnset() { + vals[59] = psql.Arg(s.Reqsubdiv.MustGetNull()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if !s.Reqtarget.IsUnset() { + vals[60] = psql.Arg(s.Reqtarget.MustGetNull()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + + if !s.Reqzip.IsUnset() { + vals[61] = psql.Arg(s.Reqzip.MustGetNull()) + } else { + vals[61] = psql.Raw("DEFAULT") + } + + if !s.Responsedaycount.IsUnset() { + vals[62] = psql.Arg(s.Responsedaycount.MustGetNull()) + } else { + vals[62] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[63] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[63] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[64] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[64] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[65] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[65] = psql.Raw("DEFAULT") + } + + if !s.Scheduled.IsUnset() { + vals[66] = psql.Arg(s.Scheduled.MustGetNull()) + } else { + vals[66] = psql.Raw("DEFAULT") + } + + if !s.Scheduleddate.IsUnset() { + vals[67] = psql.Arg(s.Scheduleddate.MustGetNull()) + } else { + vals[67] = psql.Raw("DEFAULT") + } + + if !s.Source.IsUnset() { + vals[68] = psql.Arg(s.Source.MustGetNull()) + } else { + vals[68] = psql.Raw("DEFAULT") + } + + if !s.SRNumber.IsUnset() { + vals[69] = psql.Arg(s.SRNumber.MustGetNull()) + } else { + vals[69] = psql.Raw("DEFAULT") + } + + if !s.Status.IsUnset() { + vals[70] = psql.Arg(s.Status.MustGetNull()) + } else { + vals[70] = psql.Raw("DEFAULT") + } + + if !s.Supervisor.IsUnset() { + vals[71] = psql.Arg(s.Supervisor.MustGetNull()) + } else { + vals[71] = psql.Raw("DEFAULT") + } + + if !s.Techclosed.IsUnset() { + vals[72] = psql.Arg(s.Techclosed.MustGetNull()) + } else { + vals[72] = psql.Raw("DEFAULT") + } + + if !s.Validx.IsUnset() { + vals[73] = psql.Arg(s.Validx.MustGetNull()) + } else { + vals[73] = psql.Raw("DEFAULT") + } + + if !s.Validy.IsUnset() { + vals[74] = psql.Arg(s.Validy.MustGetNull()) + } else { + vals[74] = psql.Raw("DEFAULT") + } + + if !s.Xvalue.IsUnset() { + vals[75] = psql.Arg(s.Xvalue.MustGetNull()) + } else { + vals[75] = psql.Raw("DEFAULT") + } + + if !s.Yvalue.IsUnset() { + vals[76] = psql.Arg(s.Yvalue.MustGetNull()) + } else { + vals[76] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[77] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[77] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[78] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[78] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[79] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[79] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[80] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[80] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[81] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[81] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[82] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[82] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[83] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[83] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[84] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[84] = psql.Raw("DEFAULT") + } + + if !s.Dog.IsUnset() { + vals[85] = psql.Arg(s.Dog.MustGetNull()) + } else { + vals[85] = psql.Raw("DEFAULT") + } + + if !s.Spanish.IsUnset() { + vals[86] = psql.Arg(s.Spanish.MustGetNull()) + } else { + vals[86] = psql.Raw("DEFAULT") + } + + if !s.ScheduleNotes.IsUnset() { + vals[87] = psql.Arg(s.ScheduleNotes.MustGetNull()) + } else { + vals[87] = psql.Raw("DEFAULT") + } + + if !s.SchedulePeriod.IsUnset() { + vals[88] = psql.Arg(s.SchedulePeriod.MustGetNull()) + } else { + vals[88] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[89] = psql.Arg(s.Version.MustGet()) + } else { + vals[89] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryServicerequestSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 90) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accepted.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accepted")...), + psql.Arg(s.Accepted), + }}) + } + + if !s.Acceptedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "acceptedby")...), + psql.Arg(s.Acceptedby), + }}) + } + + if !s.Accepteddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accepteddate")...), + psql.Arg(s.Accepteddate), + }}) + } + + if !s.Allowed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "allowed")...), + psql.Arg(s.Allowed), + }}) + } + + if !s.Assignedtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "assignedtech")...), + psql.Arg(s.Assignedtech), + }}) + } + + if !s.Clraddr1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clraddr1")...), + psql.Arg(s.Clraddr1), + }}) + } + + if !s.Clraddr2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clraddr2")...), + psql.Arg(s.Clraddr2), + }}) + } + + if !s.Clranon.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clranon")...), + psql.Arg(s.Clranon), + }}) + } + + if !s.Clrcity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcity")...), + psql.Arg(s.Clrcity), + }}) + } + + if !s.Clrcompany.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcompany")...), + psql.Arg(s.Clrcompany), + }}) + } + + if !s.Clrcontpref.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrcontpref")...), + psql.Arg(s.Clrcontpref), + }}) + } + + if !s.Clremail.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clremail")...), + psql.Arg(s.Clremail), + }}) + } + + if !s.Clrfname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrfname")...), + psql.Arg(s.Clrfname), + }}) + } + + if !s.Clrother.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrother")...), + psql.Arg(s.Clrother), + }}) + } + + if !s.Clrphone1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrphone1")...), + psql.Arg(s.Clrphone1), + }}) + } + + if !s.Clrphone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrphone2")...), + psql.Arg(s.Clrphone2), + }}) + } + + if !s.Clrstate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrstate")...), + psql.Arg(s.Clrstate), + }}) + } + + if !s.Clrzip.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "clrzip")...), + psql.Arg(s.Clrzip), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Datetimeclosed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "datetimeclosed")...), + psql.Arg(s.Datetimeclosed), + }}) + } + + if !s.Duedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "duedate")...), + psql.Arg(s.Duedate), + }}) + } + + if !s.Entrytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "entrytech")...), + psql.Arg(s.Entrytech), + }}) + } + + if !s.Estcompletedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "estcompletedate")...), + psql.Arg(s.Estcompletedate), + }}) + } + + if !s.Externalerror.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalerror")...), + psql.Arg(s.Externalerror), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Firstresponsedate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "firstresponsedate")...), + psql.Arg(s.Firstresponsedate), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Issuesreported.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "issuesreported")...), + psql.Arg(s.Issuesreported), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Nextaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextaction")...), + psql.Arg(s.Nextaction), + }}) + } + + if !s.Notificationtimestamp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notificationtimestamp")...), + psql.Arg(s.Notificationtimestamp), + }}) + } + + if !s.Notified.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notified")...), + psql.Arg(s.Notified), + }}) + } + + if !s.Notifieddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notifieddate")...), + psql.Arg(s.Notifieddate), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Recdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recdatetime")...), + psql.Arg(s.Recdatetime), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Rejectedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejectedby")...), + psql.Arg(s.Rejectedby), + }}) + } + + if !s.Rejecteddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejecteddate")...), + psql.Arg(s.Rejecteddate), + }}) + } + + if !s.Rejectedreason.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rejectedreason")...), + psql.Arg(s.Rejectedreason), + }}) + } + + if !s.Reqaddr1.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqaddr1")...), + psql.Arg(s.Reqaddr1), + }}) + } + + if !s.Reqaddr2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqaddr2")...), + psql.Arg(s.Reqaddr2), + }}) + } + + if !s.Reqcity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcity")...), + psql.Arg(s.Reqcity), + }}) + } + + if !s.Reqcompany.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcompany")...), + psql.Arg(s.Reqcompany), + }}) + } + + if !s.Reqcrossst.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqcrossst")...), + psql.Arg(s.Reqcrossst), + }}) + } + + if !s.Reqdescr.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqdescr")...), + psql.Arg(s.Reqdescr), + }}) + } + + if !s.Reqfldnotes.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqfldnotes")...), + psql.Arg(s.Reqfldnotes), + }}) + } + + if !s.Reqmapgrid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqmapgrid")...), + psql.Arg(s.Reqmapgrid), + }}) + } + + if !s.Reqnotesforcust.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqnotesforcust")...), + psql.Arg(s.Reqnotesforcust), + }}) + } + + if !s.Reqnotesfortech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqnotesfortech")...), + psql.Arg(s.Reqnotesfortech), + }}) + } + + if !s.Reqpermission.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqpermission")...), + psql.Arg(s.Reqpermission), + }}) + } + + if !s.Reqprogramactions.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqprogramactions")...), + psql.Arg(s.Reqprogramactions), + }}) + } + + if !s.Reqstate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqstate")...), + psql.Arg(s.Reqstate), + }}) + } + + if !s.Reqsubdiv.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqsubdiv")...), + psql.Arg(s.Reqsubdiv), + }}) + } + + if !s.Reqtarget.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqtarget")...), + psql.Arg(s.Reqtarget), + }}) + } + + if !s.Reqzip.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reqzip")...), + psql.Arg(s.Reqzip), + }}) + } + + if !s.Responsedaycount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "responsedaycount")...), + psql.Arg(s.Responsedaycount), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Scheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scheduled")...), + psql.Arg(s.Scheduled), + }}) + } + + if !s.Scheduleddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "scheduleddate")...), + psql.Arg(s.Scheduleddate), + }}) + } + + if !s.Source.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "source")...), + psql.Arg(s.Source), + }}) + } + + if !s.SRNumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sr_number")...), + psql.Arg(s.SRNumber), + }}) + } + + if !s.Status.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "status")...), + psql.Arg(s.Status), + }}) + } + + if !s.Supervisor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "supervisor")...), + psql.Arg(s.Supervisor), + }}) + } + + if !s.Techclosed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "techclosed")...), + psql.Arg(s.Techclosed), + }}) + } + + if !s.Validx.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "validx")...), + psql.Arg(s.Validx), + }}) + } + + if !s.Validy.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "validy")...), + psql.Arg(s.Validy), + }}) + } + + if !s.Xvalue.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "xvalue")...), + psql.Arg(s.Xvalue), + }}) + } + + if !s.Yvalue.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "yvalue")...), + psql.Arg(s.Yvalue), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Dog.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "dog")...), + psql.Arg(s.Dog), + }}) + } + + if !s.Spanish.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "spanish")...), + psql.Arg(s.Spanish), + }}) + } + + if !s.ScheduleNotes.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "schedule_notes")...), + psql.Arg(s.ScheduleNotes), + }}) + } + + if !s.SchedulePeriod.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "schedule_period")...), + psql.Arg(s.SchedulePeriod), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryServicerequest retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryServicerequest(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryServicerequest, error) { + if len(cols) == 0 { + return HistoryServicerequests.Query( + sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryServicerequests.Query( + sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryServicerequests.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryServicerequestExists checks the presence of a single record by primary key +func HistoryServicerequestExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryServicerequests.Query( + sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryServicerequest is retrieved from the database +func (o *HistoryServicerequest) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryServicerequests.AfterSelectHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryServicerequests.AfterInsertHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryServicerequest +func (o *HistoryServicerequest) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryServicerequest) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_servicerequest", "objectid"), psql.Quote("history_servicerequest", "version")).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 HistoryServicerequest +func (o *HistoryServicerequest) Update(ctx context.Context, exec bob.Executor, s *HistoryServicerequestSetter) error { + v, err := HistoryServicerequests.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 HistoryServicerequest record with an executor +func (o *HistoryServicerequest) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryServicerequests.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryServicerequest using the executor +func (o *HistoryServicerequest) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryServicerequests.Query( + sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryServicerequestSlice is retrieved from the database +func (o HistoryServicerequestSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryServicerequests.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryServicerequests.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryServicerequestSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_servicerequest", "objectid"), psql.Quote("history_servicerequest", "version")).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 HistoryServicerequestSlice) copyMatchingRows(from ...*HistoryServicerequest) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryServicerequestSlice) 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 HistoryServicerequests.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 *HistoryServicerequest: + o.copyMatchingRows(retrieved) + case []*HistoryServicerequest: + o.copyMatchingRows(retrieved...) + case HistoryServicerequestSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryServicerequest or a slice of HistoryServicerequest + // then run the AfterUpdateHooks on the slice + _, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryServicerequestSlice) 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 HistoryServicerequests.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 *HistoryServicerequest: + o.copyMatchingRows(retrieved) + case []*HistoryServicerequest: + o.copyMatchingRows(retrieved...) + case HistoryServicerequestSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryServicerequest or a slice of HistoryServicerequest + // then run the AfterDeleteHooks on the slice + _, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryServicerequestSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryServicerequestSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryServicerequests.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryServicerequestSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryServicerequests.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryServicerequestSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryServicerequests.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 *HistoryServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryServicerequestSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, historyServicerequest0 *HistoryServicerequest, organization1 *Organization) (*HistoryServicerequest, error) { + setter := &HistoryServicerequestSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyServicerequest0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryServicerequestOrganization0: %w", err) + } + + return historyServicerequest0, nil +} + +func (historyServicerequest0 *HistoryServicerequest) 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 = attachHistoryServicerequestOrganization0(ctx, exec, 1, historyServicerequest0, organization1) + if err != nil { + return err + } + + historyServicerequest0.R.Organization = organization1 + + organization1.R.HistoryServicerequests = append(organization1.R.HistoryServicerequests, historyServicerequest0) + + return nil +} + +func (historyServicerequest0 *HistoryServicerequest) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryServicerequestOrganization0(ctx, exec, 1, historyServicerequest0, organization1) + if err != nil { + return err + } + + historyServicerequest0.R.Organization = organization1 + + organization1.R.HistoryServicerequests = append(organization1.R.HistoryServicerequests, historyServicerequest0) + + return nil +} + +type historyServicerequestWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accepted psql.WhereNullMod[Q, int16] + Acceptedby psql.WhereNullMod[Q, string] + Accepteddate psql.WhereNullMod[Q, int64] + Allowed psql.WhereNullMod[Q, string] + Assignedtech psql.WhereNullMod[Q, string] + Clraddr1 psql.WhereNullMod[Q, string] + Clraddr2 psql.WhereNullMod[Q, string] + Clranon psql.WhereNullMod[Q, int16] + Clrcity psql.WhereNullMod[Q, string] + Clrcompany psql.WhereNullMod[Q, string] + Clrcontpref psql.WhereNullMod[Q, string] + Clremail psql.WhereNullMod[Q, string] + Clrfname psql.WhereNullMod[Q, string] + Clrother psql.WhereNullMod[Q, string] + Clrphone1 psql.WhereNullMod[Q, string] + Clrphone2 psql.WhereNullMod[Q, string] + Clrstate psql.WhereNullMod[Q, string] + Clrzip psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Datetimeclosed psql.WhereNullMod[Q, int64] + Duedate psql.WhereNullMod[Q, int64] + Entrytech psql.WhereNullMod[Q, string] + Estcompletedate psql.WhereNullMod[Q, int64] + Externalerror psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Firstresponsedate psql.WhereNullMod[Q, int64] + Globalid psql.WhereNullMod[Q, string] + Issuesreported psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Nextaction psql.WhereNullMod[Q, string] + Notificationtimestamp psql.WhereNullMod[Q, string] + Notified psql.WhereNullMod[Q, int16] + Notifieddate psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Recdatetime psql.WhereNullMod[Q, int64] + Recordstatus psql.WhereNullMod[Q, int16] + Rejectedby psql.WhereNullMod[Q, string] + Rejecteddate psql.WhereNullMod[Q, int64] + Rejectedreason psql.WhereNullMod[Q, string] + Reqaddr1 psql.WhereNullMod[Q, string] + Reqaddr2 psql.WhereNullMod[Q, string] + Reqcity psql.WhereNullMod[Q, string] + Reqcompany psql.WhereNullMod[Q, string] + Reqcrossst psql.WhereNullMod[Q, string] + Reqdescr psql.WhereNullMod[Q, string] + Reqfldnotes psql.WhereNullMod[Q, string] + Reqmapgrid psql.WhereNullMod[Q, string] + Reqnotesforcust psql.WhereNullMod[Q, string] + Reqnotesfortech psql.WhereNullMod[Q, string] + Reqpermission psql.WhereNullMod[Q, int16] + Reqprogramactions psql.WhereNullMod[Q, string] + Reqstate psql.WhereNullMod[Q, string] + Reqsubdiv psql.WhereNullMod[Q, string] + Reqtarget psql.WhereNullMod[Q, string] + Reqzip psql.WhereNullMod[Q, string] + Responsedaycount psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Scheduled psql.WhereNullMod[Q, int16] + Scheduleddate psql.WhereNullMod[Q, int64] + Source psql.WhereNullMod[Q, string] + SRNumber psql.WhereNullMod[Q, int64] + Status psql.WhereNullMod[Q, string] + Supervisor psql.WhereNullMod[Q, string] + Techclosed psql.WhereNullMod[Q, string] + Validx psql.WhereNullMod[Q, string] + Validy psql.WhereNullMod[Q, string] + Xvalue psql.WhereNullMod[Q, string] + Yvalue psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Dog psql.WhereNullMod[Q, int64] + Spanish psql.WhereNullMod[Q, int64] + ScheduleNotes psql.WhereNullMod[Q, string] + SchedulePeriod psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyServicerequestWhere[Q]) AliasedAs(alias string) historyServicerequestWhere[Q] { + return buildHistoryServicerequestWhere[Q](buildHistoryServicerequestColumns(alias)) +} + +func buildHistoryServicerequestWhere[Q psql.Filterable](cols historyServicerequestColumns) historyServicerequestWhere[Q] { + return historyServicerequestWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Allowed: psql.WhereNull[Q, string](cols.Allowed), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), + Clraddr1: psql.WhereNull[Q, string](cols.Clraddr1), + Clraddr2: psql.WhereNull[Q, string](cols.Clraddr2), + Clranon: psql.WhereNull[Q, int16](cols.Clranon), + Clrcity: psql.WhereNull[Q, string](cols.Clrcity), + Clrcompany: psql.WhereNull[Q, string](cols.Clrcompany), + Clrcontpref: psql.WhereNull[Q, string](cols.Clrcontpref), + Clremail: psql.WhereNull[Q, string](cols.Clremail), + Clrfname: psql.WhereNull[Q, string](cols.Clrfname), + Clrother: psql.WhereNull[Q, string](cols.Clrother), + Clrphone1: psql.WhereNull[Q, string](cols.Clrphone1), + Clrphone2: psql.WhereNull[Q, string](cols.Clrphone2), + Clrstate: psql.WhereNull[Q, string](cols.Clrstate), + Clrzip: psql.WhereNull[Q, string](cols.Clrzip), + Comments: psql.WhereNull[Q, string](cols.Comments), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Datetimeclosed: psql.WhereNull[Q, int64](cols.Datetimeclosed), + Duedate: psql.WhereNull[Q, int64](cols.Duedate), + Entrytech: psql.WhereNull[Q, string](cols.Entrytech), + Estcompletedate: psql.WhereNull[Q, int64](cols.Estcompletedate), + Externalerror: psql.WhereNull[Q, string](cols.Externalerror), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Firstresponsedate: psql.WhereNull[Q, int64](cols.Firstresponsedate), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Issuesreported: psql.WhereNull[Q, string](cols.Issuesreported), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Nextaction: psql.WhereNull[Q, string](cols.Nextaction), + Notificationtimestamp: psql.WhereNull[Q, string](cols.Notificationtimestamp), + Notified: psql.WhereNull[Q, int16](cols.Notified), + Notifieddate: psql.WhereNull[Q, int64](cols.Notifieddate), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Recdatetime: psql.WhereNull[Q, int64](cols.Recdatetime), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Rejectedby: psql.WhereNull[Q, string](cols.Rejectedby), + Rejecteddate: psql.WhereNull[Q, int64](cols.Rejecteddate), + Rejectedreason: psql.WhereNull[Q, string](cols.Rejectedreason), + Reqaddr1: psql.WhereNull[Q, string](cols.Reqaddr1), + Reqaddr2: psql.WhereNull[Q, string](cols.Reqaddr2), + Reqcity: psql.WhereNull[Q, string](cols.Reqcity), + Reqcompany: psql.WhereNull[Q, string](cols.Reqcompany), + Reqcrossst: psql.WhereNull[Q, string](cols.Reqcrossst), + Reqdescr: psql.WhereNull[Q, string](cols.Reqdescr), + Reqfldnotes: psql.WhereNull[Q, string](cols.Reqfldnotes), + Reqmapgrid: psql.WhereNull[Q, string](cols.Reqmapgrid), + Reqnotesforcust: psql.WhereNull[Q, string](cols.Reqnotesforcust), + Reqnotesfortech: psql.WhereNull[Q, string](cols.Reqnotesfortech), + Reqpermission: psql.WhereNull[Q, int16](cols.Reqpermission), + Reqprogramactions: psql.WhereNull[Q, string](cols.Reqprogramactions), + Reqstate: psql.WhereNull[Q, string](cols.Reqstate), + Reqsubdiv: psql.WhereNull[Q, string](cols.Reqsubdiv), + Reqtarget: psql.WhereNull[Q, string](cols.Reqtarget), + Reqzip: psql.WhereNull[Q, string](cols.Reqzip), + Responsedaycount: psql.WhereNull[Q, int16](cols.Responsedaycount), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Scheduled: psql.WhereNull[Q, int16](cols.Scheduled), + Scheduleddate: psql.WhereNull[Q, int64](cols.Scheduleddate), + Source: psql.WhereNull[Q, string](cols.Source), + SRNumber: psql.WhereNull[Q, int64](cols.SRNumber), + Status: psql.WhereNull[Q, string](cols.Status), + Supervisor: psql.WhereNull[Q, string](cols.Supervisor), + Techclosed: psql.WhereNull[Q, string](cols.Techclosed), + Validx: psql.WhereNull[Q, string](cols.Validx), + Validy: psql.WhereNull[Q, string](cols.Validy), + Xvalue: psql.WhereNull[Q, string](cols.Xvalue), + Yvalue: psql.WhereNull[Q, string](cols.Yvalue), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Dog: psql.WhereNull[Q, int64](cols.Dog), + Spanish: psql.WhereNull[Q, int64](cols.Spanish), + ScheduleNotes: psql.WhereNull[Q, string](cols.ScheduleNotes), + SchedulePeriod: psql.WhereNull[Q, string](cols.SchedulePeriod), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryServicerequest) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyServicerequest cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryServicerequests = HistoryServicerequestSlice{o} + } + return nil + default: + return fmt.Errorf("historyServicerequest has no relationship %q", name) + } +} + +type historyServicerequestPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryServicerequestPreloader() historyServicerequestPreloader { + return historyServicerequestPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryServicerequests, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyServicerequestThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryServicerequestThenLoader[Q orm.Loadable]() historyServicerequestThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyServicerequestThenLoader[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 historyServicerequest's Organization into the .R struct +func (o *HistoryServicerequest) 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.HistoryServicerequests = HistoryServicerequestSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyServicerequest's Organization into the .R struct +func (os HistoryServicerequestSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryServicerequests = append(rel.R.HistoryServicerequests, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyServicerequestJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyServicerequestJoins[Q]) aliasedAs(alias string) historyServicerequestJoins[Q] { + return buildHistoryServicerequestJoins[Q](buildHistoryServicerequestColumns(alias), j.typ) +} + +func buildHistoryServicerequestJoins[Q dialect.Joinable](cols historyServicerequestColumns, typ string) historyServicerequestJoins[Q] { + return historyServicerequestJoins[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/history_speciesabundance.bob.go b/models/history_speciesabundance.bob.go new file mode 100644 index 00000000..7064dd75 --- /dev/null +++ b/models/history_speciesabundance.bob.go @@ -0,0 +1,1392 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historySpeciesabundanceR `db:"-" ` +} + +// HistorySpeciesabundanceSlice is an alias for a slice of pointers to HistorySpeciesabundance. +// This should almost always be used instead of []*HistorySpeciesabundance. +type HistorySpeciesabundanceSlice []*HistorySpeciesabundance + +// HistorySpeciesabundances contains methods to work with the history_speciesabundance table +var HistorySpeciesabundances = psql.NewTablex[*HistorySpeciesabundance, HistorySpeciesabundanceSlice, *HistorySpeciesabundanceSetter]("", "history_speciesabundance", buildHistorySpeciesabundanceColumns("history_speciesabundance")) + +// HistorySpeciesabundancesQuery is a query on the history_speciesabundance table +type HistorySpeciesabundancesQuery = *psql.ViewQuery[*HistorySpeciesabundance, HistorySpeciesabundanceSlice] + +// historySpeciesabundanceR is where relationships are stored. +type historySpeciesabundanceR struct { + Organization *Organization // history_speciesabundance.history_speciesabundance_organization_id_fkey +} + +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", + ).WithParent("history_speciesabundance"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Bloodedfem: psql.Quote(alias, "bloodedfem"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Eggs: psql.Quote(alias, "eggs"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Females: psql.Quote(alias, "females"), + Gravidfem: psql.Quote(alias, "gravidfem"), + Globalid: psql.Quote(alias, "globalid"), + Larvae: psql.Quote(alias, "larvae"), + Males: psql.Quote(alias, "males"), + Objectid: psql.Quote(alias, "objectid"), + Poolstogen: psql.Quote(alias, "poolstogen"), + Processed: psql.Quote(alias, "processed"), + Pupae: psql.Quote(alias, "pupae"), + Species: psql.Quote(alias, "species"), + Total: psql.Quote(alias, "total"), + TrapdataID: psql.Quote(alias, "trapdata_id"), + Unknown: psql.Quote(alias, "unknown"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Globalzscore: psql.Quote(alias, "globalzscore"), + H3R7: psql.Quote(alias, "h3r7"), + H3R8: psql.Quote(alias, "h3r8"), + R7score: psql.Quote(alias, "r7score"), + R8score: psql.Quote(alias, "r8score"), + Yearweek: psql.Quote(alias, "yearweek"), + Version: psql.Quote(alias, "version"), + } +} + +type historySpeciesabundanceColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Bloodedfem psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Eggs psql.Expression + Editdate psql.Expression + Editor psql.Expression + Females psql.Expression + Gravidfem psql.Expression + Globalid psql.Expression + Larvae psql.Expression + Males psql.Expression + Objectid psql.Expression + Poolstogen psql.Expression + Processed psql.Expression + Pupae psql.Expression + Species psql.Expression + Total psql.Expression + TrapdataID psql.Expression + Unknown psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Globalzscore psql.Expression + H3R7 psql.Expression + H3R8 psql.Expression + R7score psql.Expression + R8score psql.Expression + Yearweek psql.Expression + Version psql.Expression +} + +func (c historySpeciesabundanceColumns) Alias() string { + return c.tableAlias +} + +func (historySpeciesabundanceColumns) AliasedAs(alias string) historySpeciesabundanceColumns { + return buildHistorySpeciesabundanceColumns(alias) +} + +// HistorySpeciesabundanceSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistorySpeciesabundanceSetter) SetColumns() []string { + vals := make([]string, 0, 33) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Bloodedfem.IsUnset() { + vals = append(vals, "bloodedfem") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Eggs.IsUnset() { + vals = append(vals, "eggs") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Females.IsUnset() { + vals = append(vals, "females") + } + if !s.Gravidfem.IsUnset() { + vals = append(vals, "gravidfem") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Larvae.IsUnset() { + vals = append(vals, "larvae") + } + if !s.Males.IsUnset() { + vals = append(vals, "males") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Poolstogen.IsUnset() { + vals = append(vals, "poolstogen") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Pupae.IsUnset() { + vals = append(vals, "pupae") + } + if !s.Species.IsUnset() { + vals = append(vals, "species") + } + if !s.Total.IsUnset() { + vals = append(vals, "total") + } + if !s.TrapdataID.IsUnset() { + vals = append(vals, "trapdata_id") + } + if !s.Unknown.IsUnset() { + vals = append(vals, "unknown") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Globalzscore.IsUnset() { + vals = append(vals, "globalzscore") + } + if !s.H3R7.IsUnset() { + vals = append(vals, "h3r7") + } + if !s.H3R8.IsUnset() { + vals = append(vals, "h3r8") + } + if !s.R7score.IsUnset() { + vals = append(vals, "r7score") + } + if !s.R8score.IsUnset() { + vals = append(vals, "r8score") + } + if !s.Yearweek.IsUnset() { + vals = append(vals, "yearweek") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistorySpeciesabundanceSetter) Overwrite(t *HistorySpeciesabundance) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Bloodedfem.IsUnset() { + t.Bloodedfem = s.Bloodedfem.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Eggs.IsUnset() { + t.Eggs = s.Eggs.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Females.IsUnset() { + t.Females = s.Females.MustGetNull() + } + if !s.Gravidfem.IsUnset() { + t.Gravidfem = s.Gravidfem.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Larvae.IsUnset() { + t.Larvae = s.Larvae.MustGetNull() + } + if !s.Males.IsUnset() { + t.Males = s.Males.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Poolstogen.IsUnset() { + t.Poolstogen = s.Poolstogen.MustGetNull() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Pupae.IsUnset() { + t.Pupae = s.Pupae.MustGetNull() + } + if !s.Species.IsUnset() { + t.Species = s.Species.MustGetNull() + } + if !s.Total.IsUnset() { + t.Total = s.Total.MustGetNull() + } + if !s.TrapdataID.IsUnset() { + t.TrapdataID = s.TrapdataID.MustGetNull() + } + if !s.Unknown.IsUnset() { + t.Unknown = s.Unknown.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Globalzscore.IsUnset() { + t.Globalzscore = s.Globalzscore.MustGetNull() + } + if !s.H3R7.IsUnset() { + t.H3R7 = s.H3R7.MustGetNull() + } + if !s.H3R8.IsUnset() { + t.H3R8 = s.H3R8.MustGetNull() + } + if !s.R7score.IsUnset() { + t.R7score = s.R7score.MustGetNull() + } + if !s.R8score.IsUnset() { + t.R8score = s.R8score.MustGetNull() + } + if !s.Yearweek.IsUnset() { + t.Yearweek = s.Yearweek.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistorySpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistorySpeciesabundances.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, 33) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Bloodedfem.IsUnset() { + vals[1] = psql.Arg(s.Bloodedfem.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Eggs.IsUnset() { + vals[4] = psql.Arg(s.Eggs.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[5] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[6] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Females.IsUnset() { + vals[7] = psql.Arg(s.Females.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Gravidfem.IsUnset() { + vals[8] = psql.Arg(s.Gravidfem.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[9] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Larvae.IsUnset() { + vals[10] = psql.Arg(s.Larvae.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Males.IsUnset() { + vals[11] = psql.Arg(s.Males.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[12] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Poolstogen.IsUnset() { + vals[13] = psql.Arg(s.Poolstogen.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[14] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Pupae.IsUnset() { + vals[15] = psql.Arg(s.Pupae.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Species.IsUnset() { + vals[16] = psql.Arg(s.Species.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Total.IsUnset() { + vals[17] = psql.Arg(s.Total.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.TrapdataID.IsUnset() { + vals[18] = psql.Arg(s.TrapdataID.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Unknown.IsUnset() { + vals[19] = psql.Arg(s.Unknown.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[20] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[21] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[22] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[23] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[24] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[25] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Globalzscore.IsUnset() { + vals[26] = psql.Arg(s.Globalzscore.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.H3R7.IsUnset() { + vals[27] = psql.Arg(s.H3R7.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.H3R8.IsUnset() { + vals[28] = psql.Arg(s.H3R8.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.R7score.IsUnset() { + vals[29] = psql.Arg(s.R7score.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.R8score.IsUnset() { + vals[30] = psql.Arg(s.R8score.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Yearweek.IsUnset() { + vals[31] = psql.Arg(s.Yearweek.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, "", ", ", "") + })) +} + +func (s HistorySpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistorySpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 33) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Bloodedfem.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "bloodedfem")...), + psql.Arg(s.Bloodedfem), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Eggs.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "eggs")...), + psql.Arg(s.Eggs), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Females.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "females")...), + psql.Arg(s.Females), + }}) + } + + if !s.Gravidfem.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gravidfem")...), + psql.Arg(s.Gravidfem), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Larvae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "larvae")...), + psql.Arg(s.Larvae), + }}) + } + + if !s.Males.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "males")...), + psql.Arg(s.Males), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Poolstogen.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "poolstogen")...), + psql.Arg(s.Poolstogen), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Pupae.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pupae")...), + psql.Arg(s.Pupae), + }}) + } + + if !s.Species.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "species")...), + psql.Arg(s.Species), + }}) + } + + if !s.Total.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "total")...), + psql.Arg(s.Total), + }}) + } + + if !s.TrapdataID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapdata_id")...), + psql.Arg(s.TrapdataID), + }}) + } + + if !s.Unknown.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "unknown")...), + psql.Arg(s.Unknown), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Globalzscore.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalzscore")...), + psql.Arg(s.Globalzscore), + }}) + } + + if !s.H3R7.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r7")...), + psql.Arg(s.H3R7), + }}) + } + + if !s.H3R8.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r8")...), + psql.Arg(s.H3R8), + }}) + } + + if !s.R7score.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "r7score")...), + psql.Arg(s.R7score), + }}) + } + + if !s.R8score.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "r8score")...), + psql.Arg(s.R8score), + }}) + } + + if !s.Yearweek.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "yearweek")...), + psql.Arg(s.Yearweek), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistorySpeciesabundance retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistorySpeciesabundance(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySpeciesabundance, error) { + if len(cols) == 0 { + return HistorySpeciesabundances.Query( + sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistorySpeciesabundances.Query( + sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistorySpeciesabundances.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistorySpeciesabundanceExists checks the presence of a single record by primary key +func HistorySpeciesabundanceExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistorySpeciesabundances.Query( + sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistorySpeciesabundance is retrieved from the database +func (o *HistorySpeciesabundance) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistorySpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistorySpeciesabundance +func (o *HistorySpeciesabundance) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistorySpeciesabundance) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_speciesabundance", "objectid"), psql.Quote("history_speciesabundance", "version")).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 HistorySpeciesabundance +func (o *HistorySpeciesabundance) Update(ctx context.Context, exec bob.Executor, s *HistorySpeciesabundanceSetter) error { + v, err := HistorySpeciesabundances.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 HistorySpeciesabundance record with an executor +func (o *HistorySpeciesabundance) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistorySpeciesabundances.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistorySpeciesabundance using the executor +func (o *HistorySpeciesabundance) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistorySpeciesabundances.Query( + sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistorySpeciesabundanceSlice is retrieved from the database +func (o HistorySpeciesabundanceSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistorySpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistorySpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistorySpeciesabundanceSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_speciesabundance", "objectid"), psql.Quote("history_speciesabundance", "version")).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 HistorySpeciesabundanceSlice) copyMatchingRows(from ...*HistorySpeciesabundance) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistorySpeciesabundanceSlice) 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 HistorySpeciesabundances.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 *HistorySpeciesabundance: + o.copyMatchingRows(retrieved) + case []*HistorySpeciesabundance: + o.copyMatchingRows(retrieved...) + case HistorySpeciesabundanceSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySpeciesabundance or a slice of HistorySpeciesabundance + // then run the AfterUpdateHooks on the slice + _, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistorySpeciesabundanceSlice) 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 HistorySpeciesabundances.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 *HistorySpeciesabundance: + o.copyMatchingRows(retrieved) + case []*HistorySpeciesabundance: + o.copyMatchingRows(retrieved...) + case HistorySpeciesabundanceSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistorySpeciesabundance or a slice of HistorySpeciesabundance + // then run the AfterDeleteHooks on the slice + _, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistorySpeciesabundanceSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySpeciesabundanceSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySpeciesabundances.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistorySpeciesabundanceSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistorySpeciesabundances.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistorySpeciesabundanceSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistorySpeciesabundances.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 *HistorySpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistorySpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistorySpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundance0 *HistorySpeciesabundance, organization1 *Organization) (*HistorySpeciesabundance, error) { + setter := &HistorySpeciesabundanceSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historySpeciesabundance0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistorySpeciesabundanceOrganization0: %w", err) + } + + return historySpeciesabundance0, nil +} + +func (historySpeciesabundance0 *HistorySpeciesabundance) 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 = attachHistorySpeciesabundanceOrganization0(ctx, exec, 1, historySpeciesabundance0, organization1) + if err != nil { + return err + } + + historySpeciesabundance0.R.Organization = organization1 + + organization1.R.HistorySpeciesabundances = append(organization1.R.HistorySpeciesabundances, historySpeciesabundance0) + + return nil +} + +func (historySpeciesabundance0 *HistorySpeciesabundance) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistorySpeciesabundanceOrganization0(ctx, exec, 1, historySpeciesabundance0, organization1) + if err != nil { + return err + } + + historySpeciesabundance0.R.Organization = organization1 + + organization1.R.HistorySpeciesabundances = append(organization1.R.HistorySpeciesabundances, historySpeciesabundance0) + + return nil +} + +type historySpeciesabundanceWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Bloodedfem psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Eggs psql.WhereNullMod[Q, int16] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Females psql.WhereNullMod[Q, int64] + Gravidfem psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Larvae psql.WhereNullMod[Q, int16] + Males psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Poolstogen psql.WhereNullMod[Q, int16] + Processed psql.WhereNullMod[Q, int16] + Pupae psql.WhereNullMod[Q, int16] + Species psql.WhereNullMod[Q, string] + Total psql.WhereNullMod[Q, int64] + TrapdataID psql.WhereNullMod[Q, string] + Unknown psql.WhereNullMod[Q, int16] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Globalzscore psql.WhereNullMod[Q, float64] + H3R7 psql.WhereNullMod[Q, string] + H3R8 psql.WhereNullMod[Q, string] + R7score psql.WhereNullMod[Q, float64] + R8score psql.WhereNullMod[Q, float64] + Yearweek psql.WhereNullMod[Q, int64] + Version psql.WhereMod[Q, int32] +} + +func (historySpeciesabundanceWhere[Q]) AliasedAs(alias string) historySpeciesabundanceWhere[Q] { + return buildHistorySpeciesabundanceWhere[Q](buildHistorySpeciesabundanceColumns(alias)) +} + +func buildHistorySpeciesabundanceWhere[Q psql.Filterable](cols historySpeciesabundanceColumns) historySpeciesabundanceWhere[Q] { + return historySpeciesabundanceWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Eggs: psql.WhereNull[Q, int16](cols.Eggs), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Females: psql.WhereNull[Q, int64](cols.Females), + Gravidfem: psql.WhereNull[Q, int16](cols.Gravidfem), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Larvae: psql.WhereNull[Q, int16](cols.Larvae), + Males: psql.WhereNull[Q, int16](cols.Males), + Objectid: psql.Where[Q, int32](cols.Objectid), + Poolstogen: psql.WhereNull[Q, int16](cols.Poolstogen), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Pupae: psql.WhereNull[Q, int16](cols.Pupae), + Species: psql.WhereNull[Q, string](cols.Species), + Total: psql.WhereNull[Q, int64](cols.Total), + TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + Unknown: psql.WhereNull[Q, int16](cols.Unknown), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Globalzscore: psql.WhereNull[Q, float64](cols.Globalzscore), + H3R7: psql.WhereNull[Q, string](cols.H3R7), + H3R8: psql.WhereNull[Q, string](cols.H3R8), + R7score: psql.WhereNull[Q, float64](cols.R7score), + R8score: psql.WhereNull[Q, float64](cols.R8score), + Yearweek: psql.WhereNull[Q, int64](cols.Yearweek), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistorySpeciesabundance) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historySpeciesabundance cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistorySpeciesabundances = HistorySpeciesabundanceSlice{o} + } + return nil + default: + return fmt.Errorf("historySpeciesabundance has no relationship %q", name) + } +} + +type historySpeciesabundancePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistorySpeciesabundancePreloader() historySpeciesabundancePreloader { + return historySpeciesabundancePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistorySpeciesabundances, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historySpeciesabundanceThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistorySpeciesabundanceThenLoader[Q orm.Loadable]() historySpeciesabundanceThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historySpeciesabundanceThenLoader[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 historySpeciesabundance's Organization into the .R struct +func (o *HistorySpeciesabundance) 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.HistorySpeciesabundances = HistorySpeciesabundanceSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historySpeciesabundance's Organization into the .R struct +func (os HistorySpeciesabundanceSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistorySpeciesabundances = append(rel.R.HistorySpeciesabundances, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historySpeciesabundanceJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historySpeciesabundanceJoins[Q]) aliasedAs(alias string) historySpeciesabundanceJoins[Q] { + return buildHistorySpeciesabundanceJoins[Q](buildHistorySpeciesabundanceColumns(alias), j.typ) +} + +func buildHistorySpeciesabundanceJoins[Q dialect.Joinable](cols historySpeciesabundanceColumns, typ string) historySpeciesabundanceJoins[Q] { + return historySpeciesabundanceJoins[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/history_stormdrain.bob.go b/models/history_stormdrain.bob.go new file mode 100644 index 00000000..886f7920 --- /dev/null +++ b/models/history_stormdrain.bob.go @@ -0,0 +1,1142 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyStormdrainR `db:"-" ` +} + +// HistoryStormdrainSlice is an alias for a slice of pointers to HistoryStormdrain. +// This should almost always be used instead of []*HistoryStormdrain. +type HistoryStormdrainSlice []*HistoryStormdrain + +// HistoryStormdrains contains methods to work with the history_stormdrain table +var HistoryStormdrains = psql.NewTablex[*HistoryStormdrain, HistoryStormdrainSlice, *HistoryStormdrainSetter]("", "history_stormdrain", buildHistoryStormdrainColumns("history_stormdrain")) + +// HistoryStormdrainsQuery is a query on the history_stormdrain table +type HistoryStormdrainsQuery = *psql.ViewQuery[*HistoryStormdrain, HistoryStormdrainSlice] + +// historyStormdrainR is where relationships are stored. +type historyStormdrainR struct { + Organization *Organization // history_stormdrain.history_stormdrain_organization_id_fkey +} + +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", + ).WithParent("history_stormdrain"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Jurisdiction: psql.Quote(alias, "jurisdiction"), + Lastaction: psql.Quote(alias, "lastaction"), + Laststatus: psql.Quote(alias, "laststatus"), + Lasttreatdate: psql.Quote(alias, "lasttreatdate"), + Nexttreatmentdate: psql.Quote(alias, "nexttreatmentdate"), + Objectid: psql.Quote(alias, "objectid"), + Symbology: psql.Quote(alias, "symbology"), + Type: psql.Quote(alias, "type"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyStormdrainColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Jurisdiction psql.Expression + Lastaction psql.Expression + Laststatus psql.Expression + Lasttreatdate psql.Expression + Nexttreatmentdate psql.Expression + Objectid psql.Expression + Symbology psql.Expression + Type psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyStormdrainColumns) Alias() string { + return c.tableAlias +} + +func (historyStormdrainColumns) AliasedAs(alias string) historyStormdrainColumns { + return buildHistoryStormdrainColumns(alias) +} + +// HistoryStormdrainSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryStormdrainSetter) SetColumns() []string { + vals := make([]string, 0, 23) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Jurisdiction.IsUnset() { + vals = append(vals, "jurisdiction") + } + if !s.Lastaction.IsUnset() { + vals = append(vals, "lastaction") + } + if !s.Laststatus.IsUnset() { + vals = append(vals, "laststatus") + } + if !s.Lasttreatdate.IsUnset() { + vals = append(vals, "lasttreatdate") + } + if !s.Nexttreatmentdate.IsUnset() { + vals = append(vals, "nexttreatmentdate") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Symbology.IsUnset() { + vals = append(vals, "symbology") + } + if !s.Type.IsUnset() { + vals = append(vals, "type") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryStormdrainSetter) Overwrite(t *HistoryStormdrain) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Jurisdiction.IsUnset() { + t.Jurisdiction = s.Jurisdiction.MustGetNull() + } + if !s.Lastaction.IsUnset() { + t.Lastaction = s.Lastaction.MustGetNull() + } + if !s.Laststatus.IsUnset() { + t.Laststatus = s.Laststatus.MustGetNull() + } + if !s.Lasttreatdate.IsUnset() { + t.Lasttreatdate = s.Lasttreatdate.MustGetNull() + } + if !s.Nexttreatmentdate.IsUnset() { + t.Nexttreatmentdate = s.Nexttreatmentdate.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Symbology.IsUnset() { + t.Symbology = s.Symbology.MustGetNull() + } + if !s.Type.IsUnset() { + t.Type = s.Type.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryStormdrainSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryStormdrains.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, 23) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Jurisdiction.IsUnset() { + vals[6] = psql.Arg(s.Jurisdiction.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Lastaction.IsUnset() { + vals[7] = psql.Arg(s.Lastaction.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Laststatus.IsUnset() { + vals[8] = psql.Arg(s.Laststatus.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Lasttreatdate.IsUnset() { + vals[9] = psql.Arg(s.Lasttreatdate.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Nexttreatmentdate.IsUnset() { + vals[10] = psql.Arg(s.Nexttreatmentdate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[11] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Symbology.IsUnset() { + vals[12] = psql.Arg(s.Symbology.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Type.IsUnset() { + vals[13] = psql.Arg(s.Type.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[14] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[15] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[18] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[19] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryStormdrainSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 23) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Jurisdiction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "jurisdiction")...), + psql.Arg(s.Jurisdiction), + }}) + } + + if !s.Lastaction.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lastaction")...), + psql.Arg(s.Lastaction), + }}) + } + + if !s.Laststatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "laststatus")...), + psql.Arg(s.Laststatus), + }}) + } + + if !s.Lasttreatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lasttreatdate")...), + psql.Arg(s.Lasttreatdate), + }}) + } + + if !s.Nexttreatmentdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nexttreatmentdate")...), + psql.Arg(s.Nexttreatmentdate), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Symbology.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "symbology")...), + psql.Arg(s.Symbology), + }}) + } + + if !s.Type.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type")...), + psql.Arg(s.Type), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryStormdrain retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryStormdrain(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryStormdrain, error) { + if len(cols) == 0 { + return HistoryStormdrains.Query( + sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryStormdrains.Query( + sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryStormdrains.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryStormdrainExists checks the presence of a single record by primary key +func HistoryStormdrainExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryStormdrains.Query( + sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryStormdrain is retrieved from the database +func (o *HistoryStormdrain) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryStormdrains.AfterSelectHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryStormdrains.AfterInsertHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryStormdrain +func (o *HistoryStormdrain) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryStormdrain) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_stormdrain", "objectid"), psql.Quote("history_stormdrain", "version")).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 HistoryStormdrain +func (o *HistoryStormdrain) Update(ctx context.Context, exec bob.Executor, s *HistoryStormdrainSetter) error { + v, err := HistoryStormdrains.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 HistoryStormdrain record with an executor +func (o *HistoryStormdrain) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryStormdrains.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryStormdrain using the executor +func (o *HistoryStormdrain) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryStormdrains.Query( + sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryStormdrainSlice is retrieved from the database +func (o HistoryStormdrainSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryStormdrains.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryStormdrains.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryStormdrainSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_stormdrain", "objectid"), psql.Quote("history_stormdrain", "version")).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 HistoryStormdrainSlice) copyMatchingRows(from ...*HistoryStormdrain) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryStormdrainSlice) 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 HistoryStormdrains.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 *HistoryStormdrain: + o.copyMatchingRows(retrieved) + case []*HistoryStormdrain: + o.copyMatchingRows(retrieved...) + case HistoryStormdrainSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryStormdrain or a slice of HistoryStormdrain + // then run the AfterUpdateHooks on the slice + _, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryStormdrainSlice) 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 HistoryStormdrains.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 *HistoryStormdrain: + o.copyMatchingRows(retrieved) + case []*HistoryStormdrain: + o.copyMatchingRows(retrieved...) + case HistoryStormdrainSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryStormdrain or a slice of HistoryStormdrain + // then run the AfterDeleteHooks on the slice + _, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryStormdrainSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryStormdrainSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryStormdrains.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryStormdrainSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryStormdrains.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryStormdrainSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryStormdrains.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 *HistoryStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, historyStormdrain0 *HistoryStormdrain, organization1 *Organization) (*HistoryStormdrain, error) { + setter := &HistoryStormdrainSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyStormdrain0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryStormdrainOrganization0: %w", err) + } + + return historyStormdrain0, nil +} + +func (historyStormdrain0 *HistoryStormdrain) 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 = attachHistoryStormdrainOrganization0(ctx, exec, 1, historyStormdrain0, organization1) + if err != nil { + return err + } + + historyStormdrain0.R.Organization = organization1 + + organization1.R.HistoryStormdrains = append(organization1.R.HistoryStormdrains, historyStormdrain0) + + return nil +} + +func (historyStormdrain0 *HistoryStormdrain) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryStormdrainOrganization0(ctx, exec, 1, historyStormdrain0, organization1) + if err != nil { + return err + } + + historyStormdrain0.R.Organization = organization1 + + organization1.R.HistoryStormdrains = append(organization1.R.HistoryStormdrains, historyStormdrain0) + + return nil +} + +type historyStormdrainWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Jurisdiction psql.WhereNullMod[Q, string] + Lastaction psql.WhereNullMod[Q, string] + Laststatus psql.WhereNullMod[Q, string] + Lasttreatdate psql.WhereNullMod[Q, int64] + Nexttreatmentdate psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Symbology psql.WhereNullMod[Q, string] + Type psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyStormdrainWhere[Q]) AliasedAs(alias string) historyStormdrainWhere[Q] { + return buildHistoryStormdrainWhere[Q](buildHistoryStormdrainColumns(alias)) +} + +func buildHistoryStormdrainWhere[Q psql.Filterable](cols historyStormdrainColumns) historyStormdrainWhere[Q] { + return historyStormdrainWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Lastaction: psql.WhereNull[Q, string](cols.Lastaction), + Laststatus: psql.WhereNull[Q, string](cols.Laststatus), + Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), + Nexttreatmentdate: psql.WhereNull[Q, int64](cols.Nexttreatmentdate), + Objectid: psql.Where[Q, int32](cols.Objectid), + Symbology: psql.WhereNull[Q, string](cols.Symbology), + Type: psql.WhereNull[Q, string](cols.Type), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryStormdrain) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyStormdrain cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryStormdrains = HistoryStormdrainSlice{o} + } + return nil + default: + return fmt.Errorf("historyStormdrain has no relationship %q", name) + } +} + +type historyStormdrainPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryStormdrainPreloader() historyStormdrainPreloader { + return historyStormdrainPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryStormdrains, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyStormdrainThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryStormdrainThenLoader[Q orm.Loadable]() historyStormdrainThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyStormdrainThenLoader[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 historyStormdrain's Organization into the .R struct +func (o *HistoryStormdrain) 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.HistoryStormdrains = HistoryStormdrainSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyStormdrain's Organization into the .R struct +func (os HistoryStormdrainSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryStormdrains = append(rel.R.HistoryStormdrains, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyStormdrainJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyStormdrainJoins[Q]) aliasedAs(alias string) historyStormdrainJoins[Q] { + return buildHistoryStormdrainJoins[Q](buildHistoryStormdrainColumns(alias), j.typ) +} + +func buildHistoryStormdrainJoins[Q dialect.Joinable](cols historyStormdrainColumns, typ string) historyStormdrainJoins[Q] { + return historyStormdrainJoins[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/history_timecard.bob.go b/models/history_timecard.bob.go new file mode 100644 index 00000000..24aca5de --- /dev/null +++ b/models/history_timecard.bob.go @@ -0,0 +1,1367 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyTimecardR `db:"-" ` +} + +// HistoryTimecardSlice is an alias for a slice of pointers to HistoryTimecard. +// This should almost always be used instead of []*HistoryTimecard. +type HistoryTimecardSlice []*HistoryTimecard + +// HistoryTimecards contains methods to work with the history_timecard table +var HistoryTimecards = psql.NewTablex[*HistoryTimecard, HistoryTimecardSlice, *HistoryTimecardSetter]("", "history_timecard", buildHistoryTimecardColumns("history_timecard")) + +// HistoryTimecardsQuery is a query on the history_timecard table +type HistoryTimecardsQuery = *psql.ViewQuery[*HistoryTimecard, HistoryTimecardSlice] + +// historyTimecardR is where relationships are stored. +type historyTimecardR struct { + Organization *Organization // history_timecard.history_timecard_organization_id_fkey +} + +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", + ).WithParent("history_timecard"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Equiptype: psql.Quote(alias, "equiptype"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Globalid: psql.Quote(alias, "globalid"), + Lclocid: psql.Quote(alias, "lclocid"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Samplelocid: psql.Quote(alias, "samplelocid"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Traplocid: psql.Quote(alias, "traplocid"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Rodentlocid: psql.Quote(alias, "rodentlocid"), + Version: psql.Quote(alias, "version"), + } +} + +type historyTimecardColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Equiptype psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Globalid psql.Expression + Lclocid psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Samplelocid psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Traplocid psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Rodentlocid psql.Expression + Version psql.Expression +} + +func (c historyTimecardColumns) Alias() string { + return c.tableAlias +} + +func (historyTimecardColumns) AliasedAs(alias string) historyTimecardColumns { + return buildHistoryTimecardColumns(alias) +} + +// HistoryTimecardSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryTimecardSetter) SetColumns() []string { + vals := make([]string, 0, 32) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Equiptype.IsUnset() { + vals = append(vals, "equiptype") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Lclocid.IsUnset() { + vals = append(vals, "lclocid") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Samplelocid.IsUnset() { + vals = append(vals, "samplelocid") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Traplocid.IsUnset() { + vals = append(vals, "traplocid") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Rodentlocid.IsUnset() { + vals = append(vals, "rodentlocid") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryTimecardSetter) Overwrite(t *HistoryTimecard) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Equiptype.IsUnset() { + t.Equiptype = s.Equiptype.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Lclocid.IsUnset() { + t.Lclocid = s.Lclocid.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Samplelocid.IsUnset() { + t.Samplelocid = s.Samplelocid.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Traplocid.IsUnset() { + t.Traplocid = s.Traplocid.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Rodentlocid.IsUnset() { + t.Rodentlocid = s.Rodentlocid.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryTimecardSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryTimecards.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, 32) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[3] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[4] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Equiptype.IsUnset() { + vals[6] = psql.Arg(s.Equiptype.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[10] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Lclocid.IsUnset() { + vals[12] = psql.Arg(s.Lclocid.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[13] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[14] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[15] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[16] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[17] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Samplelocid.IsUnset() { + vals[18] = psql.Arg(s.Samplelocid.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[19] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[20] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Traplocid.IsUnset() { + vals[21] = psql.Arg(s.Traplocid.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[22] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[23] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[24] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[25] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[26] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[27] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[28] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[29] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Rodentlocid.IsUnset() { + vals[30] = psql.Arg(s.Rodentlocid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[31] = psql.Arg(s.Version.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryTimecardSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 32) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Equiptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "equiptype")...), + psql.Arg(s.Equiptype), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Lclocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lclocid")...), + psql.Arg(s.Lclocid), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Samplelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "samplelocid")...), + psql.Arg(s.Samplelocid), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Traplocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "traplocid")...), + psql.Arg(s.Traplocid), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Rodentlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "rodentlocid")...), + psql.Arg(s.Rodentlocid), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryTimecard retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryTimecard(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTimecard, error) { + if len(cols) == 0 { + return HistoryTimecards.Query( + sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryTimecards.Query( + sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryTimecards.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryTimecardExists checks the presence of a single record by primary key +func HistoryTimecardExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryTimecards.Query( + sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryTimecard is retrieved from the database +func (o *HistoryTimecard) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTimecards.AfterSelectHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryTimecards.AfterInsertHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryTimecard +func (o *HistoryTimecard) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryTimecard) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_timecard", "objectid"), psql.Quote("history_timecard", "version")).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 HistoryTimecard +func (o *HistoryTimecard) Update(ctx context.Context, exec bob.Executor, s *HistoryTimecardSetter) error { + v, err := HistoryTimecards.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 HistoryTimecard record with an executor +func (o *HistoryTimecard) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryTimecards.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryTimecard using the executor +func (o *HistoryTimecard) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryTimecards.Query( + sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryTimecardSlice is retrieved from the database +func (o HistoryTimecardSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTimecards.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryTimecards.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryTimecardSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_timecard", "objectid"), psql.Quote("history_timecard", "version")).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 HistoryTimecardSlice) copyMatchingRows(from ...*HistoryTimecard) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryTimecardSlice) 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 HistoryTimecards.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 *HistoryTimecard: + o.copyMatchingRows(retrieved) + case []*HistoryTimecard: + o.copyMatchingRows(retrieved...) + case HistoryTimecardSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTimecard or a slice of HistoryTimecard + // then run the AfterUpdateHooks on the slice + _, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryTimecardSlice) 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 HistoryTimecards.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 *HistoryTimecard: + o.copyMatchingRows(retrieved) + case []*HistoryTimecard: + o.copyMatchingRows(retrieved...) + case HistoryTimecardSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTimecard or a slice of HistoryTimecard + // then run the AfterDeleteHooks on the slice + _, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryTimecardSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTimecardSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTimecards.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryTimecardSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTimecards.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryTimecardSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryTimecards.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 *HistoryTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, historyTimecard0 *HistoryTimecard, organization1 *Organization) (*HistoryTimecard, error) { + setter := &HistoryTimecardSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyTimecard0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryTimecardOrganization0: %w", err) + } + + return historyTimecard0, nil +} + +func (historyTimecard0 *HistoryTimecard) 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 = attachHistoryTimecardOrganization0(ctx, exec, 1, historyTimecard0, organization1) + if err != nil { + return err + } + + historyTimecard0.R.Organization = organization1 + + organization1.R.HistoryTimecards = append(organization1.R.HistoryTimecards, historyTimecard0) + + return nil +} + +func (historyTimecard0 *HistoryTimecard) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryTimecardOrganization0(ctx, exec, 1, historyTimecard0, organization1) + if err != nil { + return err + } + + historyTimecard0.R.Organization = organization1 + + organization1.R.HistoryTimecards = append(organization1.R.HistoryTimecards, historyTimecard0) + + return nil +} + +type historyTimecardWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Equiptype psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Lclocid psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Samplelocid psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Traplocid psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Rodentlocid psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyTimecardWhere[Q]) AliasedAs(alias string) historyTimecardWhere[Q] { + return buildHistoryTimecardWhere[Q](buildHistoryTimecardColumns(alias)) +} + +func buildHistoryTimecardWhere[Q psql.Filterable](cols historyTimecardColumns) historyTimecardWhere[Q] { + return historyTimecardWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Lclocid: psql.WhereNull[Q, string](cols.Lclocid), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Samplelocid: psql.WhereNull[Q, string](cols.Samplelocid), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Traplocid: psql.WhereNull[Q, string](cols.Traplocid), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Rodentlocid: psql.WhereNull[Q, string](cols.Rodentlocid), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryTimecard) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyTimecard cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryTimecards = HistoryTimecardSlice{o} + } + return nil + default: + return fmt.Errorf("historyTimecard has no relationship %q", name) + } +} + +type historyTimecardPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryTimecardPreloader() historyTimecardPreloader { + return historyTimecardPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryTimecards, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyTimecardThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryTimecardThenLoader[Q orm.Loadable]() historyTimecardThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyTimecardThenLoader[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 historyTimecard's Organization into the .R struct +func (o *HistoryTimecard) 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.HistoryTimecards = HistoryTimecardSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyTimecard's Organization into the .R struct +func (os HistoryTimecardSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryTimecards = append(rel.R.HistoryTimecards, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyTimecardJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyTimecardJoins[Q]) aliasedAs(alias string) historyTimecardJoins[Q] { + return buildHistoryTimecardJoins[Q](buildHistoryTimecardColumns(alias), j.typ) +} + +func buildHistoryTimecardJoins[Q dialect.Joinable](cols historyTimecardColumns, typ string) historyTimecardJoins[Q] { + return historyTimecardJoins[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/history_trapdata.bob.go b/models/history_trapdata.bob.go new file mode 100644 index 00000000..6f9977d2 --- /dev/null +++ b/models/history_trapdata.bob.go @@ -0,0 +1,1717 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyTrapdatumR `db:"-" ` +} + +// HistoryTrapdatumSlice is an alias for a slice of pointers to HistoryTrapdatum. +// This should almost always be used instead of []*HistoryTrapdatum. +type HistoryTrapdatumSlice []*HistoryTrapdatum + +// HistoryTrapdata contains methods to work with the history_trapdata table +var HistoryTrapdata = psql.NewTablex[*HistoryTrapdatum, HistoryTrapdatumSlice, *HistoryTrapdatumSetter]("", "history_trapdata", buildHistoryTrapdatumColumns("history_trapdata")) + +// HistoryTrapdataQuery is a query on the history_trapdata table +type HistoryTrapdataQuery = *psql.ViewQuery[*HistoryTrapdatum, HistoryTrapdatumSlice] + +// historyTrapdatumR is where relationships are stored. +type historyTrapdatumR struct { + Organization *Organization // history_trapdata.history_trapdata_organization_id_fkey +} + +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", + ).WithParent("history_trapdata"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Avetemp: psql.Quote(alias, "avetemp"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Field: psql.Quote(alias, "field"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Idbytech: psql.Quote(alias, "idbytech"), + Locationname: psql.Quote(alias, "locationname"), + LocID: psql.Quote(alias, "loc_id"), + LR: psql.Quote(alias, "lr"), + Objectid: psql.Quote(alias, "objectid"), + Processed: psql.Quote(alias, "processed"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sitecond: psql.Quote(alias, "sitecond"), + Sortbytech: psql.Quote(alias, "sortbytech"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Trapactivitytype: psql.Quote(alias, "trapactivitytype"), + Trapcondition: psql.Quote(alias, "trapcondition"), + Trapnights: psql.Quote(alias, "trapnights"), + Traptype: psql.Quote(alias, "traptype"), + Voltage: psql.Quote(alias, "voltage"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Lure: psql.Quote(alias, "lure"), + Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), + Vectorsurvtraplocationid: psql.Quote(alias, "vectorsurvtraplocationid"), + Version: psql.Quote(alias, "version"), + } +} + +type historyTrapdatumColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Avetemp psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Field psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Idbytech psql.Expression + Locationname psql.Expression + LocID psql.Expression + LR psql.Expression + Objectid psql.Expression + Processed psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sitecond psql.Expression + Sortbytech psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Trapactivitytype psql.Expression + Trapcondition psql.Expression + Trapnights psql.Expression + Traptype psql.Expression + Voltage psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Lure psql.Expression + Vectorsurvtrapdataid psql.Expression + Vectorsurvtraplocationid psql.Expression + Version psql.Expression +} + +func (c historyTrapdatumColumns) Alias() string { + return c.tableAlias +} + +func (historyTrapdatumColumns) AliasedAs(alias string) historyTrapdatumColumns { + return buildHistoryTrapdatumColumns(alias) +} + +// HistoryTrapdatumSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryTrapdatumSetter) SetColumns() []string { + vals := make([]string, 0, 46) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Field.IsUnset() { + vals = append(vals, "field") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Idbytech.IsUnset() { + vals = append(vals, "idbytech") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.LocID.IsUnset() { + vals = append(vals, "loc_id") + } + if !s.LR.IsUnset() { + vals = append(vals, "lr") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Processed.IsUnset() { + vals = append(vals, "processed") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Sortbytech.IsUnset() { + vals = append(vals, "sortbytech") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Trapactivitytype.IsUnset() { + vals = append(vals, "trapactivitytype") + } + if !s.Trapcondition.IsUnset() { + vals = append(vals, "trapcondition") + } + if !s.Trapnights.IsUnset() { + vals = append(vals, "trapnights") + } + if !s.Traptype.IsUnset() { + vals = append(vals, "traptype") + } + if !s.Voltage.IsUnset() { + vals = append(vals, "voltage") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Lure.IsUnset() { + vals = append(vals, "lure") + } + if !s.Vectorsurvtrapdataid.IsUnset() { + vals = append(vals, "vectorsurvtrapdataid") + } + if !s.Vectorsurvtraplocationid.IsUnset() { + vals = append(vals, "vectorsurvtraplocationid") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryTrapdatumSetter) Overwrite(t *HistoryTrapdatum) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Field.IsUnset() { + t.Field = s.Field.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Idbytech.IsUnset() { + t.Idbytech = s.Idbytech.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.LocID.IsUnset() { + t.LocID = s.LocID.MustGetNull() + } + if !s.LR.IsUnset() { + t.LR = s.LR.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Processed.IsUnset() { + t.Processed = s.Processed.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Sortbytech.IsUnset() { + t.Sortbytech = s.Sortbytech.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Trapactivitytype.IsUnset() { + t.Trapactivitytype = s.Trapactivitytype.MustGetNull() + } + if !s.Trapcondition.IsUnset() { + t.Trapcondition = s.Trapcondition.MustGetNull() + } + if !s.Trapnights.IsUnset() { + t.Trapnights = s.Trapnights.MustGetNull() + } + if !s.Traptype.IsUnset() { + t.Traptype = s.Traptype.MustGetNull() + } + if !s.Voltage.IsUnset() { + t.Voltage = s.Voltage.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Lure.IsUnset() { + t.Lure = s.Lure.MustGetNull() + } + if !s.Vectorsurvtrapdataid.IsUnset() { + t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() + } + if !s.Vectorsurvtraplocationid.IsUnset() { + t.Vectorsurvtraplocationid = s.Vectorsurvtraplocationid.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryTrapdatumSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryTrapdata.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, 46) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[1] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[2] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[3] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[4] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[6] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[7] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[8] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Field.IsUnset() { + vals[9] = psql.Arg(s.Field.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Idbytech.IsUnset() { + vals[12] = psql.Arg(s.Idbytech.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[13] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LocID.IsUnset() { + vals[14] = psql.Arg(s.LocID.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LR.IsUnset() { + vals[15] = psql.Arg(s.LR.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Processed.IsUnset() { + vals[17] = psql.Arg(s.Processed.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[18] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[19] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[20] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[21] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[22] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[23] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Sortbytech.IsUnset() { + vals[24] = psql.Arg(s.Sortbytech.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[25] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[26] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Trapactivitytype.IsUnset() { + vals[27] = psql.Arg(s.Trapactivitytype.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Trapcondition.IsUnset() { + vals[28] = psql.Arg(s.Trapcondition.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Trapnights.IsUnset() { + vals[29] = psql.Arg(s.Trapnights.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Traptype.IsUnset() { + vals[30] = psql.Arg(s.Traptype.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Voltage.IsUnset() { + vals[31] = psql.Arg(s.Voltage.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[32] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[33] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[34] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[35] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[36] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[37] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[38] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[39] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[40] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[41] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Lure.IsUnset() { + vals[42] = psql.Arg(s.Lure.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[43] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvtraplocationid.IsUnset() { + vals[44] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[45] = psql.Arg(s.Version.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 46) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Field.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "field")...), + psql.Arg(s.Field), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Idbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "idbytech")...), + psql.Arg(s.Idbytech), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.LocID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "loc_id")...), + psql.Arg(s.LocID), + }}) + } + + if !s.LR.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lr")...), + psql.Arg(s.LR), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Processed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "processed")...), + psql.Arg(s.Processed), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Sortbytech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sortbytech")...), + psql.Arg(s.Sortbytech), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Trapactivitytype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapactivitytype")...), + psql.Arg(s.Trapactivitytype), + }}) + } + + if !s.Trapcondition.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapcondition")...), + psql.Arg(s.Trapcondition), + }}) + } + + if !s.Trapnights.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "trapnights")...), + psql.Arg(s.Trapnights), + }}) + } + + if !s.Traptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "traptype")...), + psql.Arg(s.Traptype), + }}) + } + + if !s.Voltage.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "voltage")...), + psql.Arg(s.Voltage), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Lure.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "lure")...), + psql.Arg(s.Lure), + }}) + } + + if !s.Vectorsurvtrapdataid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtrapdataid")...), + psql.Arg(s.Vectorsurvtrapdataid), + }}) + } + + if !s.Vectorsurvtraplocationid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvtraplocationid")...), + psql.Arg(s.Vectorsurvtraplocationid), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryTrapdatum retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryTrapdatum(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTrapdatum, error) { + if len(cols) == 0 { + return HistoryTrapdata.Query( + sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryTrapdata.Query( + sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryTrapdata.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryTrapdatumExists checks the presence of a single record by primary key +func HistoryTrapdatumExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryTrapdata.Query( + sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryTrapdatum is retrieved from the database +func (o *HistoryTrapdatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTrapdata.AfterSelectHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryTrapdata.AfterInsertHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryTrapdatum +func (o *HistoryTrapdatum) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryTrapdatum) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_trapdata", "objectid"), psql.Quote("history_trapdata", "version")).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 HistoryTrapdatum +func (o *HistoryTrapdatum) Update(ctx context.Context, exec bob.Executor, s *HistoryTrapdatumSetter) error { + v, err := HistoryTrapdata.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 HistoryTrapdatum record with an executor +func (o *HistoryTrapdatum) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryTrapdata.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryTrapdatum using the executor +func (o *HistoryTrapdatum) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryTrapdata.Query( + sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryTrapdatumSlice is retrieved from the database +func (o HistoryTrapdatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTrapdata.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryTrapdata.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryTrapdatumSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_trapdata", "objectid"), psql.Quote("history_trapdata", "version")).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 HistoryTrapdatumSlice) copyMatchingRows(from ...*HistoryTrapdatum) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryTrapdatumSlice) 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 HistoryTrapdata.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 *HistoryTrapdatum: + o.copyMatchingRows(retrieved) + case []*HistoryTrapdatum: + o.copyMatchingRows(retrieved...) + case HistoryTrapdatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTrapdatum or a slice of HistoryTrapdatum + // then run the AfterUpdateHooks on the slice + _, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryTrapdatumSlice) 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 HistoryTrapdata.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 *HistoryTrapdatum: + o.copyMatchingRows(retrieved) + case []*HistoryTrapdatum: + o.copyMatchingRows(retrieved...) + case HistoryTrapdatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTrapdatum or a slice of HistoryTrapdatum + // then run the AfterDeleteHooks on the slice + _, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryTrapdatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTrapdatumSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTrapdata.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryTrapdatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTrapdata.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryTrapdatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryTrapdata.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 *HistoryTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, historyTrapdatum0 *HistoryTrapdatum, organization1 *Organization) (*HistoryTrapdatum, error) { + setter := &HistoryTrapdatumSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyTrapdatum0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryTrapdatumOrganization0: %w", err) + } + + return historyTrapdatum0, nil +} + +func (historyTrapdatum0 *HistoryTrapdatum) 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 = attachHistoryTrapdatumOrganization0(ctx, exec, 1, historyTrapdatum0, organization1) + if err != nil { + return err + } + + historyTrapdatum0.R.Organization = organization1 + + organization1.R.HistoryTrapdata = append(organization1.R.HistoryTrapdata, historyTrapdatum0) + + return nil +} + +func (historyTrapdatum0 *HistoryTrapdatum) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryTrapdatumOrganization0(ctx, exec, 1, historyTrapdatum0, organization1) + if err != nil { + return err + } + + historyTrapdatum0.R.Organization = organization1 + + organization1.R.HistoryTrapdata = append(organization1.R.HistoryTrapdata, historyTrapdatum0) + + return nil +} + +type historyTrapdatumWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Avetemp psql.WhereNullMod[Q, float64] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Field psql.WhereNullMod[Q, int64] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Idbytech psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + LocID psql.WhereNullMod[Q, string] + LR psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + Processed psql.WhereNullMod[Q, int16] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sitecond psql.WhereNullMod[Q, string] + Sortbytech psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Trapactivitytype psql.WhereNullMod[Q, string] + Trapcondition psql.WhereNullMod[Q, string] + Trapnights psql.WhereNullMod[Q, int16] + Traptype psql.WhereNullMod[Q, string] + Voltage psql.WhereNullMod[Q, float64] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Lure psql.WhereNullMod[Q, string] + Vectorsurvtrapdataid psql.WhereNullMod[Q, string] + Vectorsurvtraplocationid psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyTrapdatumWhere[Q]) AliasedAs(alias string) historyTrapdatumWhere[Q] { + return buildHistoryTrapdatumWhere[Q](buildHistoryTrapdatumColumns(alias)) +} + +func buildHistoryTrapdatumWhere[Q psql.Filterable](cols historyTrapdatumColumns) historyTrapdatumWhere[Q] { + return historyTrapdatumWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Field: psql.WhereNull[Q, int64](cols.Field), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Idbytech: psql.WhereNull[Q, string](cols.Idbytech), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + LocID: psql.WhereNull[Q, string](cols.LocID), + LR: psql.WhereNull[Q, int16](cols.LR), + Objectid: psql.Where[Q, int32](cols.Objectid), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Sortbytech: psql.WhereNull[Q, string](cols.Sortbytech), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Trapactivitytype: psql.WhereNull[Q, string](cols.Trapactivitytype), + Trapcondition: psql.WhereNull[Q, string](cols.Trapcondition), + Trapnights: psql.WhereNull[Q, int16](cols.Trapnights), + Traptype: psql.WhereNull[Q, string](cols.Traptype), + Voltage: psql.WhereNull[Q, float64](cols.Voltage), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Lure: psql.WhereNull[Q, string](cols.Lure), + Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), + Vectorsurvtraplocationid: psql.WhereNull[Q, string](cols.Vectorsurvtraplocationid), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryTrapdatum) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyTrapdatum cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryTrapdata = HistoryTrapdatumSlice{o} + } + return nil + default: + return fmt.Errorf("historyTrapdatum has no relationship %q", name) + } +} + +type historyTrapdatumPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryTrapdatumPreloader() historyTrapdatumPreloader { + return historyTrapdatumPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryTrapdata, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyTrapdatumThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryTrapdatumThenLoader[Q orm.Loadable]() historyTrapdatumThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyTrapdatumThenLoader[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 historyTrapdatum's Organization into the .R struct +func (o *HistoryTrapdatum) 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.HistoryTrapdata = HistoryTrapdatumSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyTrapdatum's Organization into the .R struct +func (os HistoryTrapdatumSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryTrapdata = append(rel.R.HistoryTrapdata, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyTrapdatumJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyTrapdatumJoins[Q]) aliasedAs(alias string) historyTrapdatumJoins[Q] { + return buildHistoryTrapdatumJoins[Q](buildHistoryTrapdatumColumns(alias), j.typ) +} + +func buildHistoryTrapdatumJoins[Q dialect.Joinable](cols historyTrapdatumColumns, typ string) historyTrapdatumJoins[Q] { + return historyTrapdatumJoins[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/history_traplocation.bob.go b/models/history_traplocation.bob.go new file mode 100644 index 00000000..48e86bb6 --- /dev/null +++ b/models/history_traplocation.bob.go @@ -0,0 +1,1417 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyTraplocationR `db:"-" ` +} + +// HistoryTraplocationSlice is an alias for a slice of pointers to HistoryTraplocation. +// This should almost always be used instead of []*HistoryTraplocation. +type HistoryTraplocationSlice []*HistoryTraplocation + +// HistoryTraplocations contains methods to work with the history_traplocation table +var HistoryTraplocations = psql.NewTablex[*HistoryTraplocation, HistoryTraplocationSlice, *HistoryTraplocationSetter]("", "history_traplocation", buildHistoryTraplocationColumns("history_traplocation")) + +// HistoryTraplocationsQuery is a query on the history_traplocation table +type HistoryTraplocationsQuery = *psql.ViewQuery[*HistoryTraplocation, HistoryTraplocationSlice] + +// historyTraplocationR is where relationships are stored. +type historyTraplocationR struct { + Organization *Organization // history_traplocation.history_traplocation_organization_id_fkey +} + +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", + ).WithParent("history_traplocation"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Accessdesc: psql.Quote(alias, "accessdesc"), + Active: psql.Quote(alias, "active"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Description: psql.Quote(alias, "description"), + Externalid: psql.Quote(alias, "externalid"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Gatewaysync: psql.Quote(alias, "gatewaysync"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + Locationnumber: psql.Quote(alias, "locationnumber"), + Name: psql.Quote(alias, "name"), + Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), + Objectid: psql.Quote(alias, "objectid"), + Priority: psql.Quote(alias, "priority"), + Usetype: psql.Quote(alias, "usetype"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Route: psql.Quote(alias, "route"), + RouteOrder: psql.Quote(alias, "route_order"), + SetDow: psql.Quote(alias, "set_dow"), + Vectorsurvsiteid: psql.Quote(alias, "vectorsurvsiteid"), + H3R7: psql.Quote(alias, "h3r7"), + H3R8: psql.Quote(alias, "h3r8"), + Version: psql.Quote(alias, "version"), + } +} + +type historyTraplocationColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Accessdesc psql.Expression + Active psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Description psql.Expression + Externalid psql.Expression + Editdate psql.Expression + Editor psql.Expression + Gatewaysync psql.Expression + Globalid psql.Expression + Habitat psql.Expression + Locationnumber psql.Expression + Name psql.Expression + Nextactiondatescheduled psql.Expression + Objectid psql.Expression + Priority psql.Expression + Usetype psql.Expression + Zone psql.Expression + Zone2 psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Route psql.Expression + RouteOrder psql.Expression + SetDow psql.Expression + Vectorsurvsiteid psql.Expression + H3R7 psql.Expression + H3R8 psql.Expression + Version psql.Expression +} + +func (c historyTraplocationColumns) Alias() string { + return c.tableAlias +} + +func (historyTraplocationColumns) AliasedAs(alias string) historyTraplocationColumns { + return buildHistoryTraplocationColumns(alias) +} + +// HistoryTraplocationSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryTraplocationSetter) SetColumns() []string { + vals := make([]string, 0, 34) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Accessdesc.IsUnset() { + vals = append(vals, "accessdesc") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Description.IsUnset() { + vals = append(vals, "description") + } + if !s.Externalid.IsUnset() { + vals = append(vals, "externalid") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Gatewaysync.IsUnset() { + vals = append(vals, "gatewaysync") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.Locationnumber.IsUnset() { + vals = append(vals, "locationnumber") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if !s.Nextactiondatescheduled.IsUnset() { + vals = append(vals, "nextactiondatescheduled") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Priority.IsUnset() { + vals = append(vals, "priority") + } + if !s.Usetype.IsUnset() { + vals = append(vals, "usetype") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if !s.Route.IsUnset() { + vals = append(vals, "route") + } + if !s.RouteOrder.IsUnset() { + vals = append(vals, "route_order") + } + if !s.SetDow.IsUnset() { + vals = append(vals, "set_dow") + } + if !s.Vectorsurvsiteid.IsUnset() { + vals = append(vals, "vectorsurvsiteid") + } + if !s.H3R7.IsUnset() { + vals = append(vals, "h3r7") + } + if !s.H3R8.IsUnset() { + vals = append(vals, "h3r8") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryTraplocationSetter) Overwrite(t *HistoryTraplocation) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Accessdesc.IsUnset() { + t.Accessdesc = s.Accessdesc.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Description.IsUnset() { + t.Description = s.Description.MustGetNull() + } + if !s.Externalid.IsUnset() { + t.Externalid = s.Externalid.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Gatewaysync.IsUnset() { + t.Gatewaysync = s.Gatewaysync.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.Locationnumber.IsUnset() { + t.Locationnumber = s.Locationnumber.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if !s.Nextactiondatescheduled.IsUnset() { + t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Priority.IsUnset() { + t.Priority = s.Priority.MustGetNull() + } + if !s.Usetype.IsUnset() { + t.Usetype = s.Usetype.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if !s.Route.IsUnset() { + t.Route = s.Route.MustGetNull() + } + if !s.RouteOrder.IsUnset() { + t.RouteOrder = s.RouteOrder.MustGetNull() + } + if !s.SetDow.IsUnset() { + t.SetDow = s.SetDow.MustGetNull() + } + if !s.Vectorsurvsiteid.IsUnset() { + t.Vectorsurvsiteid = s.Vectorsurvsiteid.MustGetNull() + } + if !s.H3R7.IsUnset() { + t.H3R7 = s.H3R7.MustGetNull() + } + if !s.H3R8.IsUnset() { + t.H3R8 = s.H3R8.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryTraplocationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryTraplocations.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, 34) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Accessdesc.IsUnset() { + vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[2] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[3] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[4] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[5] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Description.IsUnset() { + vals[6] = psql.Arg(s.Description.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Externalid.IsUnset() { + vals[7] = psql.Arg(s.Externalid.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[8] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[9] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Gatewaysync.IsUnset() { + vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[11] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[12] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Locationnumber.IsUnset() { + vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[14] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Nextactiondatescheduled.IsUnset() { + vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[16] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Priority.IsUnset() { + vals[17] = psql.Arg(s.Priority.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.Usetype.IsUnset() { + vals[18] = psql.Arg(s.Usetype.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[19] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[20] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Route.IsUnset() { + vals[27] = psql.Arg(s.Route.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.RouteOrder.IsUnset() { + vals[28] = psql.Arg(s.RouteOrder.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.SetDow.IsUnset() { + vals[29] = psql.Arg(s.SetDow.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Vectorsurvsiteid.IsUnset() { + vals[30] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.H3R7.IsUnset() { + vals[31] = psql.Arg(s.H3R7.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.H3R8.IsUnset() { + vals[32] = psql.Arg(s.H3R8.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, "", ", ", "") + })) +} + +func (s HistoryTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryTraplocationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 34) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Accessdesc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "accessdesc")...), + psql.Arg(s.Accessdesc), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Description.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "description")...), + psql.Arg(s.Description), + }}) + } + + if !s.Externalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "externalid")...), + psql.Arg(s.Externalid), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Gatewaysync.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "gatewaysync")...), + psql.Arg(s.Gatewaysync), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.Locationnumber.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationnumber")...), + psql.Arg(s.Locationnumber), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if !s.Nextactiondatescheduled.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "nextactiondatescheduled")...), + psql.Arg(s.Nextactiondatescheduled), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Priority.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "priority")...), + psql.Arg(s.Priority), + }}) + } + + if !s.Usetype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "usetype")...), + psql.Arg(s.Usetype), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if !s.Route.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "route")...), + psql.Arg(s.Route), + }}) + } + + if !s.RouteOrder.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "route_order")...), + psql.Arg(s.RouteOrder), + }}) + } + + if !s.SetDow.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "set_dow")...), + psql.Arg(s.SetDow), + }}) + } + + if !s.Vectorsurvsiteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "vectorsurvsiteid")...), + psql.Arg(s.Vectorsurvsiteid), + }}) + } + + if !s.H3R7.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r7")...), + psql.Arg(s.H3R7), + }}) + } + + if !s.H3R8.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "h3r8")...), + psql.Arg(s.H3R8), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryTraplocation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryTraplocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTraplocation, error) { + if len(cols) == 0 { + return HistoryTraplocations.Query( + sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryTraplocations.Query( + sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryTraplocations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryTraplocationExists checks the presence of a single record by primary key +func HistoryTraplocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryTraplocations.Query( + sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryTraplocation is retrieved from the database +func (o *HistoryTraplocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTraplocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryTraplocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryTraplocation +func (o *HistoryTraplocation) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryTraplocation) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_traplocation", "objectid"), psql.Quote("history_traplocation", "version")).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 HistoryTraplocation +func (o *HistoryTraplocation) Update(ctx context.Context, exec bob.Executor, s *HistoryTraplocationSetter) error { + v, err := HistoryTraplocations.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 HistoryTraplocation record with an executor +func (o *HistoryTraplocation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryTraplocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryTraplocation using the executor +func (o *HistoryTraplocation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryTraplocations.Query( + sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryTraplocationSlice is retrieved from the database +func (o HistoryTraplocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTraplocations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryTraplocations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryTraplocationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_traplocation", "objectid"), psql.Quote("history_traplocation", "version")).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 HistoryTraplocationSlice) copyMatchingRows(from ...*HistoryTraplocation) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryTraplocationSlice) 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 HistoryTraplocations.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 *HistoryTraplocation: + o.copyMatchingRows(retrieved) + case []*HistoryTraplocation: + o.copyMatchingRows(retrieved...) + case HistoryTraplocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTraplocation or a slice of HistoryTraplocation + // then run the AfterUpdateHooks on the slice + _, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryTraplocationSlice) 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 HistoryTraplocations.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 *HistoryTraplocation: + o.copyMatchingRows(retrieved) + case []*HistoryTraplocation: + o.copyMatchingRows(retrieved...) + case HistoryTraplocationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTraplocation or a slice of HistoryTraplocation + // then run the AfterDeleteHooks on the slice + _, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryTraplocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTraplocationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTraplocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryTraplocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTraplocations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryTraplocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryTraplocations.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 *HistoryTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyTraplocation0 *HistoryTraplocation, organization1 *Organization) (*HistoryTraplocation, error) { + setter := &HistoryTraplocationSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyTraplocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryTraplocationOrganization0: %w", err) + } + + return historyTraplocation0, nil +} + +func (historyTraplocation0 *HistoryTraplocation) 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 = attachHistoryTraplocationOrganization0(ctx, exec, 1, historyTraplocation0, organization1) + if err != nil { + return err + } + + historyTraplocation0.R.Organization = organization1 + + organization1.R.HistoryTraplocations = append(organization1.R.HistoryTraplocations, historyTraplocation0) + + return nil +} + +func (historyTraplocation0 *HistoryTraplocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryTraplocationOrganization0(ctx, exec, 1, historyTraplocation0, organization1) + if err != nil { + return err + } + + historyTraplocation0.R.Organization = organization1 + + organization1.R.HistoryTraplocations = append(organization1.R.HistoryTraplocations, historyTraplocation0) + + return nil +} + +type historyTraplocationWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Accessdesc psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Description psql.WhereNullMod[Q, string] + Externalid psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Gatewaysync psql.WhereNullMod[Q, int16] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + Locationnumber psql.WhereNullMod[Q, int64] + Name psql.WhereNullMod[Q, string] + Nextactiondatescheduled psql.WhereNullMod[Q, int64] + Objectid psql.WhereMod[Q, int32] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Route psql.WhereNullMod[Q, int64] + RouteOrder psql.WhereNullMod[Q, int64] + SetDow psql.WhereNullMod[Q, int64] + Vectorsurvsiteid psql.WhereNullMod[Q, string] + H3R7 psql.WhereNullMod[Q, string] + H3R8 psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyTraplocationWhere[Q]) AliasedAs(alias string) historyTraplocationWhere[Q] { + return buildHistoryTraplocationWhere[Q](buildHistoryTraplocationColumns(alias)) +} + +func buildHistoryTraplocationWhere[Q psql.Filterable](cols historyTraplocationColumns) historyTraplocationWhere[Q] { + return historyTraplocationWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Description: psql.WhereNull[Q, string](cols.Description), + Externalid: psql.WhereNull[Q, string](cols.Externalid), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), + Name: psql.WhereNull[Q, string](cols.Name), + Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), + Objectid: psql.Where[Q, int32](cols.Objectid), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Route: psql.WhereNull[Q, int64](cols.Route), + RouteOrder: psql.WhereNull[Q, int64](cols.RouteOrder), + SetDow: psql.WhereNull[Q, int64](cols.SetDow), + Vectorsurvsiteid: psql.WhereNull[Q, string](cols.Vectorsurvsiteid), + H3R7: psql.WhereNull[Q, string](cols.H3R7), + H3R8: psql.WhereNull[Q, string](cols.H3R8), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryTraplocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyTraplocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryTraplocations = HistoryTraplocationSlice{o} + } + return nil + default: + return fmt.Errorf("historyTraplocation has no relationship %q", name) + } +} + +type historyTraplocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryTraplocationPreloader() historyTraplocationPreloader { + return historyTraplocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryTraplocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyTraplocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryTraplocationThenLoader[Q orm.Loadable]() historyTraplocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyTraplocationThenLoader[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 historyTraplocation's Organization into the .R struct +func (o *HistoryTraplocation) 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.HistoryTraplocations = HistoryTraplocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyTraplocation's Organization into the .R struct +func (os HistoryTraplocationSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryTraplocations = append(rel.R.HistoryTraplocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyTraplocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyTraplocationJoins[Q]) aliasedAs(alias string) historyTraplocationJoins[Q] { + return buildHistoryTraplocationJoins[Q](buildHistoryTraplocationColumns(alias), j.typ) +} + +func buildHistoryTraplocationJoins[Q dialect.Joinable](cols historyTraplocationColumns, typ string) historyTraplocationJoins[Q] { + return historyTraplocationJoins[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/history_treatment.bob.go b/models/history_treatment.bob.go new file mode 100644 index 00000000..a4f23a01 --- /dev/null +++ b/models/history_treatment.bob.go @@ -0,0 +1,2017 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// HistoryTreatment is an object representing the database table. +type HistoryTreatment struct { + OrganizationID null.Val[int32] `db:"organization_id" ` + Activity null.Val[string] `db:"activity" ` + Areaunit null.Val[string] `db:"areaunit" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Barrierrouteid null.Val[string] `db:"barrierrouteid" ` + 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" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Equiptype null.Val[string] `db:"equiptype" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Flowrate null.Val[float64] `db:"flowrate" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + InspID null.Val[string] `db:"insp_id" ` + Invloc null.Val[string] `db:"invloc" ` + Linelocid null.Val[string] `db:"linelocid" ` + Locationname null.Val[string] `db:"locationname" ` + Method null.Val[string] `db:"method" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Polygonlocid null.Val[string] `db:"polygonlocid" ` + Product null.Val[string] `db:"product" ` + Ptaid null.Val[string] `db:"ptaid" ` + Qty null.Val[float64] `db:"qty" ` + Qtyunit null.Val[string] `db:"qtyunit" ` + 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" ` + Targetspecies null.Val[string] `db:"targetspecies" ` + Tirecount null.Val[int16] `db:"tirecount" ` + Treatacres null.Val[float64] `db:"treatacres" ` + Treatarea null.Val[float64] `db:"treatarea" ` + Treathectares null.Val[float64] `db:"treathectares" ` + Treatmenthours null.Val[float64] `db:"treatmenthours" ` + Treatmentlength null.Val[float64] `db:"treatmentlength" ` + Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` + Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` + Ulvrouteid null.Val[string] `db:"ulvrouteid" ` + Warningoverride null.Val[int16] `db:"warningoverride" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + TempSitecond null.Val[string] `db:"temp_sitecond" ` + Version int32 `db:"version,pk" ` + + R historyTreatmentR `db:"-" ` +} + +// HistoryTreatmentSlice is an alias for a slice of pointers to HistoryTreatment. +// This should almost always be used instead of []*HistoryTreatment. +type HistoryTreatmentSlice []*HistoryTreatment + +// HistoryTreatments contains methods to work with the history_treatment table +var HistoryTreatments = psql.NewTablex[*HistoryTreatment, HistoryTreatmentSlice, *HistoryTreatmentSetter]("", "history_treatment", buildHistoryTreatmentColumns("history_treatment")) + +// HistoryTreatmentsQuery is a query on the history_treatment table +type HistoryTreatmentsQuery = *psql.ViewQuery[*HistoryTreatment, HistoryTreatmentSlice] + +// historyTreatmentR is where relationships are stored. +type historyTreatmentR struct { + Organization *Organization // history_treatment.history_treatment_organization_id_fkey +} + +func buildHistoryTreatmentColumns(alias string) historyTreatmentColumns { + return historyTreatmentColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "organization_id", "activity", "areaunit", "avetemp", "barrierrouteid", "cbcount", "comments", "containercount", "creationdate", "creator", "enddatetime", "equiptype", "editdate", "editor", "fieldtech", "flowrate", "globalid", "habitat", "insp_id", "invloc", "linelocid", "locationname", "method", "objectid", "pointlocid", "polygonlocid", "product", "ptaid", "qty", "qtyunit", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "targetspecies", "tirecount", "treatacres", "treatarea", "treathectares", "treatmenthours", "treatmentlength", "treatmentlengthunits", "totalcostprodcut", "ulvrouteid", "warningoverride", "winddir", "windspeed", "zone", "zone2", "geometry_x", "geometry_y", "temp_sitecond", "version", + ).WithParent("history_treatment"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Activity: psql.Quote(alias, "activity"), + Areaunit: psql.Quote(alias, "areaunit"), + Avetemp: psql.Quote(alias, "avetemp"), + Barrierrouteid: psql.Quote(alias, "barrierrouteid"), + Cbcount: psql.Quote(alias, "cbcount"), + Comments: psql.Quote(alias, "comments"), + Containercount: psql.Quote(alias, "containercount"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Enddatetime: psql.Quote(alias, "enddatetime"), + Equiptype: psql.Quote(alias, "equiptype"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Fieldtech: psql.Quote(alias, "fieldtech"), + Flowrate: psql.Quote(alias, "flowrate"), + Globalid: psql.Quote(alias, "globalid"), + Habitat: psql.Quote(alias, "habitat"), + InspID: psql.Quote(alias, "insp_id"), + Invloc: psql.Quote(alias, "invloc"), + Linelocid: psql.Quote(alias, "linelocid"), + Locationname: psql.Quote(alias, "locationname"), + Method: psql.Quote(alias, "method"), + Objectid: psql.Quote(alias, "objectid"), + Pointlocid: psql.Quote(alias, "pointlocid"), + Polygonlocid: psql.Quote(alias, "polygonlocid"), + Product: psql.Quote(alias, "product"), + Ptaid: psql.Quote(alias, "ptaid"), + Qty: psql.Quote(alias, "qty"), + Qtyunit: psql.Quote(alias, "qtyunit"), + Raingauge: psql.Quote(alias, "raingauge"), + Recordstatus: psql.Quote(alias, "recordstatus"), + Reviewed: psql.Quote(alias, "reviewed"), + Reviewedby: psql.Quote(alias, "reviewedby"), + Revieweddate: psql.Quote(alias, "revieweddate"), + Sdid: psql.Quote(alias, "sdid"), + Sitecond: psql.Quote(alias, "sitecond"), + Srid: psql.Quote(alias, "srid"), + Startdatetime: psql.Quote(alias, "startdatetime"), + Targetspecies: psql.Quote(alias, "targetspecies"), + Tirecount: psql.Quote(alias, "tirecount"), + Treatacres: psql.Quote(alias, "treatacres"), + Treatarea: psql.Quote(alias, "treatarea"), + Treathectares: psql.Quote(alias, "treathectares"), + Treatmenthours: psql.Quote(alias, "treatmenthours"), + Treatmentlength: psql.Quote(alias, "treatmentlength"), + Treatmentlengthunits: psql.Quote(alias, "treatmentlengthunits"), + Totalcostprodcut: psql.Quote(alias, "totalcostprodcut"), + Ulvrouteid: psql.Quote(alias, "ulvrouteid"), + Warningoverride: psql.Quote(alias, "warningoverride"), + Winddir: psql.Quote(alias, "winddir"), + Windspeed: psql.Quote(alias, "windspeed"), + Zone: psql.Quote(alias, "zone"), + Zone2: psql.Quote(alias, "zone2"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + TempSitecond: psql.Quote(alias, "temp_sitecond"), + Version: psql.Quote(alias, "version"), + } +} + +type historyTreatmentColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Activity psql.Expression + Areaunit psql.Expression + Avetemp psql.Expression + Barrierrouteid psql.Expression + Cbcount psql.Expression + Comments psql.Expression + Containercount psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Enddatetime psql.Expression + Equiptype psql.Expression + Editdate psql.Expression + Editor psql.Expression + Fieldtech psql.Expression + Flowrate psql.Expression + Globalid psql.Expression + Habitat psql.Expression + InspID psql.Expression + Invloc psql.Expression + Linelocid psql.Expression + Locationname psql.Expression + Method psql.Expression + Objectid psql.Expression + Pointlocid psql.Expression + Polygonlocid psql.Expression + Product psql.Expression + Ptaid psql.Expression + Qty psql.Expression + Qtyunit psql.Expression + Raingauge psql.Expression + Recordstatus psql.Expression + Reviewed psql.Expression + Reviewedby psql.Expression + Revieweddate psql.Expression + Sdid psql.Expression + Sitecond psql.Expression + Srid psql.Expression + Startdatetime psql.Expression + Targetspecies psql.Expression + Tirecount psql.Expression + Treatacres psql.Expression + Treatarea psql.Expression + Treathectares psql.Expression + Treatmenthours psql.Expression + Treatmentlength psql.Expression + Treatmentlengthunits psql.Expression + Totalcostprodcut psql.Expression + Ulvrouteid psql.Expression + Warningoverride psql.Expression + Winddir psql.Expression + Windspeed psql.Expression + Zone psql.Expression + Zone2 psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + TempSitecond psql.Expression + Version psql.Expression +} + +func (c historyTreatmentColumns) Alias() string { + return c.tableAlias +} + +func (historyTreatmentColumns) AliasedAs(alias string) historyTreatmentColumns { + return buildHistoryTreatmentColumns(alias) +} + +// HistoryTreatmentSetter is used for insert/upsert/update operations +// 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" ` + Activity omitnull.Val[string] `db:"activity" ` + Areaunit omitnull.Val[string] `db:"areaunit" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Barrierrouteid omitnull.Val[string] `db:"barrierrouteid" ` + 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" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Equiptype omitnull.Val[string] `db:"equiptype" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Flowrate omitnull.Val[float64] `db:"flowrate" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + InspID omitnull.Val[string] `db:"insp_id" ` + Invloc omitnull.Val[string] `db:"invloc" ` + Linelocid omitnull.Val[string] `db:"linelocid" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Method omitnull.Val[string] `db:"method" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` + Product omitnull.Val[string] `db:"product" ` + Ptaid omitnull.Val[string] `db:"ptaid" ` + Qty omitnull.Val[float64] `db:"qty" ` + Qtyunit omitnull.Val[string] `db:"qtyunit" ` + 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" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + Tirecount omitnull.Val[int16] `db:"tirecount" ` + Treatacres omitnull.Val[float64] `db:"treatacres" ` + Treatarea omitnull.Val[float64] `db:"treatarea" ` + Treathectares omitnull.Val[float64] `db:"treathectares" ` + Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` + Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` + Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` + Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` + Ulvrouteid omitnull.Val[string] `db:"ulvrouteid" ` + Warningoverride omitnull.Val[int16] `db:"warningoverride" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + TempSitecond omitnull.Val[string] `db:"temp_sitecond" ` + Version omit.Val[int32] `db:"version,pk" ` +} + +func (s HistoryTreatmentSetter) SetColumns() []string { + vals := make([]string, 0, 58) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Activity.IsUnset() { + vals = append(vals, "activity") + } + if !s.Areaunit.IsUnset() { + vals = append(vals, "areaunit") + } + if !s.Avetemp.IsUnset() { + vals = append(vals, "avetemp") + } + if !s.Barrierrouteid.IsUnset() { + vals = append(vals, "barrierrouteid") + } + if !s.Cbcount.IsUnset() { + vals = append(vals, "cbcount") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Containercount.IsUnset() { + vals = append(vals, "containercount") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Enddatetime.IsUnset() { + vals = append(vals, "enddatetime") + } + if !s.Equiptype.IsUnset() { + vals = append(vals, "equiptype") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Fieldtech.IsUnset() { + vals = append(vals, "fieldtech") + } + if !s.Flowrate.IsUnset() { + vals = append(vals, "flowrate") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Habitat.IsUnset() { + vals = append(vals, "habitat") + } + if !s.InspID.IsUnset() { + vals = append(vals, "insp_id") + } + if !s.Invloc.IsUnset() { + vals = append(vals, "invloc") + } + if !s.Linelocid.IsUnset() { + vals = append(vals, "linelocid") + } + if !s.Locationname.IsUnset() { + vals = append(vals, "locationname") + } + if !s.Method.IsUnset() { + vals = append(vals, "method") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.Pointlocid.IsUnset() { + vals = append(vals, "pointlocid") + } + if !s.Polygonlocid.IsUnset() { + vals = append(vals, "polygonlocid") + } + if !s.Product.IsUnset() { + vals = append(vals, "product") + } + if !s.Ptaid.IsUnset() { + vals = append(vals, "ptaid") + } + if !s.Qty.IsUnset() { + vals = append(vals, "qty") + } + if !s.Qtyunit.IsUnset() { + vals = append(vals, "qtyunit") + } + if !s.Raingauge.IsUnset() { + vals = append(vals, "raingauge") + } + if !s.Recordstatus.IsUnset() { + vals = append(vals, "recordstatus") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.Reviewedby.IsUnset() { + vals = append(vals, "reviewedby") + } + if !s.Revieweddate.IsUnset() { + vals = append(vals, "revieweddate") + } + if !s.Sdid.IsUnset() { + vals = append(vals, "sdid") + } + if !s.Sitecond.IsUnset() { + vals = append(vals, "sitecond") + } + if !s.Srid.IsUnset() { + vals = append(vals, "srid") + } + if !s.Startdatetime.IsUnset() { + vals = append(vals, "startdatetime") + } + if !s.Targetspecies.IsUnset() { + vals = append(vals, "targetspecies") + } + if !s.Tirecount.IsUnset() { + vals = append(vals, "tirecount") + } + if !s.Treatacres.IsUnset() { + vals = append(vals, "treatacres") + } + if !s.Treatarea.IsUnset() { + vals = append(vals, "treatarea") + } + if !s.Treathectares.IsUnset() { + vals = append(vals, "treathectares") + } + if !s.Treatmenthours.IsUnset() { + vals = append(vals, "treatmenthours") + } + if !s.Treatmentlength.IsUnset() { + vals = append(vals, "treatmentlength") + } + if !s.Treatmentlengthunits.IsUnset() { + vals = append(vals, "treatmentlengthunits") + } + if !s.Totalcostprodcut.IsUnset() { + vals = append(vals, "totalcostprodcut") + } + if !s.Ulvrouteid.IsUnset() { + vals = append(vals, "ulvrouteid") + } + if !s.Warningoverride.IsUnset() { + vals = append(vals, "warningoverride") + } + if !s.Winddir.IsUnset() { + vals = append(vals, "winddir") + } + if !s.Windspeed.IsUnset() { + vals = append(vals, "windspeed") + } + if !s.Zone.IsUnset() { + vals = append(vals, "zone") + } + if !s.Zone2.IsUnset() { + vals = append(vals, "zone2") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.TempSitecond.IsUnset() { + vals = append(vals, "temp_sitecond") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryTreatmentSetter) Overwrite(t *HistoryTreatment) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Activity.IsUnset() { + t.Activity = s.Activity.MustGetNull() + } + if !s.Areaunit.IsUnset() { + t.Areaunit = s.Areaunit.MustGetNull() + } + if !s.Avetemp.IsUnset() { + t.Avetemp = s.Avetemp.MustGetNull() + } + if !s.Barrierrouteid.IsUnset() { + t.Barrierrouteid = s.Barrierrouteid.MustGetNull() + } + if !s.Cbcount.IsUnset() { + t.Cbcount = s.Cbcount.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Containercount.IsUnset() { + t.Containercount = s.Containercount.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Enddatetime.IsUnset() { + t.Enddatetime = s.Enddatetime.MustGetNull() + } + if !s.Equiptype.IsUnset() { + t.Equiptype = s.Equiptype.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Fieldtech.IsUnset() { + t.Fieldtech = s.Fieldtech.MustGetNull() + } + if !s.Flowrate.IsUnset() { + t.Flowrate = s.Flowrate.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Habitat.IsUnset() { + t.Habitat = s.Habitat.MustGetNull() + } + if !s.InspID.IsUnset() { + t.InspID = s.InspID.MustGetNull() + } + if !s.Invloc.IsUnset() { + t.Invloc = s.Invloc.MustGetNull() + } + if !s.Linelocid.IsUnset() { + t.Linelocid = s.Linelocid.MustGetNull() + } + if !s.Locationname.IsUnset() { + t.Locationname = s.Locationname.MustGetNull() + } + if !s.Method.IsUnset() { + t.Method = s.Method.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.Pointlocid.IsUnset() { + t.Pointlocid = s.Pointlocid.MustGetNull() + } + if !s.Polygonlocid.IsUnset() { + t.Polygonlocid = s.Polygonlocid.MustGetNull() + } + if !s.Product.IsUnset() { + t.Product = s.Product.MustGetNull() + } + if !s.Ptaid.IsUnset() { + t.Ptaid = s.Ptaid.MustGetNull() + } + if !s.Qty.IsUnset() { + t.Qty = s.Qty.MustGetNull() + } + if !s.Qtyunit.IsUnset() { + t.Qtyunit = s.Qtyunit.MustGetNull() + } + if !s.Raingauge.IsUnset() { + t.Raingauge = s.Raingauge.MustGetNull() + } + if !s.Recordstatus.IsUnset() { + t.Recordstatus = s.Recordstatus.MustGetNull() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.Reviewedby.IsUnset() { + t.Reviewedby = s.Reviewedby.MustGetNull() + } + if !s.Revieweddate.IsUnset() { + t.Revieweddate = s.Revieweddate.MustGetNull() + } + if !s.Sdid.IsUnset() { + t.Sdid = s.Sdid.MustGetNull() + } + if !s.Sitecond.IsUnset() { + t.Sitecond = s.Sitecond.MustGetNull() + } + if !s.Srid.IsUnset() { + t.Srid = s.Srid.MustGetNull() + } + if !s.Startdatetime.IsUnset() { + t.Startdatetime = s.Startdatetime.MustGetNull() + } + if !s.Targetspecies.IsUnset() { + t.Targetspecies = s.Targetspecies.MustGetNull() + } + if !s.Tirecount.IsUnset() { + t.Tirecount = s.Tirecount.MustGetNull() + } + if !s.Treatacres.IsUnset() { + t.Treatacres = s.Treatacres.MustGetNull() + } + if !s.Treatarea.IsUnset() { + t.Treatarea = s.Treatarea.MustGetNull() + } + if !s.Treathectares.IsUnset() { + t.Treathectares = s.Treathectares.MustGetNull() + } + if !s.Treatmenthours.IsUnset() { + t.Treatmenthours = s.Treatmenthours.MustGetNull() + } + if !s.Treatmentlength.IsUnset() { + t.Treatmentlength = s.Treatmentlength.MustGetNull() + } + if !s.Treatmentlengthunits.IsUnset() { + t.Treatmentlengthunits = s.Treatmentlengthunits.MustGetNull() + } + if !s.Totalcostprodcut.IsUnset() { + t.Totalcostprodcut = s.Totalcostprodcut.MustGetNull() + } + if !s.Ulvrouteid.IsUnset() { + t.Ulvrouteid = s.Ulvrouteid.MustGetNull() + } + if !s.Warningoverride.IsUnset() { + t.Warningoverride = s.Warningoverride.MustGetNull() + } + if !s.Winddir.IsUnset() { + t.Winddir = s.Winddir.MustGetNull() + } + if !s.Windspeed.IsUnset() { + t.Windspeed = s.Windspeed.MustGetNull() + } + if !s.Zone.IsUnset() { + t.Zone = s.Zone.MustGetNull() + } + if !s.Zone2.IsUnset() { + t.Zone2 = s.Zone2.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.TempSitecond.IsUnset() { + t.TempSitecond = s.TempSitecond.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryTreatmentSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryTreatments.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, 58) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Activity.IsUnset() { + vals[1] = psql.Arg(s.Activity.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Areaunit.IsUnset() { + vals[2] = psql.Arg(s.Areaunit.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Avetemp.IsUnset() { + vals[3] = psql.Arg(s.Avetemp.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Barrierrouteid.IsUnset() { + vals[4] = psql.Arg(s.Barrierrouteid.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Cbcount.IsUnset() { + vals[5] = psql.Arg(s.Cbcount.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[6] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Containercount.IsUnset() { + vals[7] = psql.Arg(s.Containercount.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[8] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[9] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.Enddatetime.IsUnset() { + vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.Equiptype.IsUnset() { + vals[11] = psql.Arg(s.Equiptype.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[12] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[13] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Fieldtech.IsUnset() { + vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.Flowrate.IsUnset() { + vals[15] = psql.Arg(s.Flowrate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[16] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.Habitat.IsUnset() { + vals[17] = psql.Arg(s.Habitat.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.InspID.IsUnset() { + vals[18] = psql.Arg(s.InspID.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.Invloc.IsUnset() { + vals[19] = psql.Arg(s.Invloc.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.Linelocid.IsUnset() { + vals[20] = psql.Arg(s.Linelocid.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if !s.Locationname.IsUnset() { + vals[21] = psql.Arg(s.Locationname.MustGetNull()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if !s.Method.IsUnset() { + vals[22] = psql.Arg(s.Method.MustGetNull()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[23] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + + if !s.Pointlocid.IsUnset() { + vals[24] = psql.Arg(s.Pointlocid.MustGetNull()) + } else { + vals[24] = psql.Raw("DEFAULT") + } + + if !s.Polygonlocid.IsUnset() { + vals[25] = psql.Arg(s.Polygonlocid.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if !s.Product.IsUnset() { + vals[26] = psql.Arg(s.Product.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if !s.Ptaid.IsUnset() { + vals[27] = psql.Arg(s.Ptaid.MustGetNull()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if !s.Qty.IsUnset() { + vals[28] = psql.Arg(s.Qty.MustGetNull()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + + if !s.Qtyunit.IsUnset() { + vals[29] = psql.Arg(s.Qtyunit.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if !s.Raingauge.IsUnset() { + vals[30] = psql.Arg(s.Raingauge.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if !s.Recordstatus.IsUnset() { + vals[31] = psql.Arg(s.Recordstatus.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[32] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if !s.Reviewedby.IsUnset() { + vals[33] = psql.Arg(s.Reviewedby.MustGetNull()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + + if !s.Revieweddate.IsUnset() { + vals[34] = psql.Arg(s.Revieweddate.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if !s.Sdid.IsUnset() { + vals[35] = psql.Arg(s.Sdid.MustGetNull()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if !s.Sitecond.IsUnset() { + vals[36] = psql.Arg(s.Sitecond.MustGetNull()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + + if !s.Srid.IsUnset() { + vals[37] = psql.Arg(s.Srid.MustGetNull()) + } else { + vals[37] = psql.Raw("DEFAULT") + } + + if !s.Startdatetime.IsUnset() { + vals[38] = psql.Arg(s.Startdatetime.MustGetNull()) + } else { + vals[38] = psql.Raw("DEFAULT") + } + + if !s.Targetspecies.IsUnset() { + vals[39] = psql.Arg(s.Targetspecies.MustGetNull()) + } else { + vals[39] = psql.Raw("DEFAULT") + } + + if !s.Tirecount.IsUnset() { + vals[40] = psql.Arg(s.Tirecount.MustGetNull()) + } else { + vals[40] = psql.Raw("DEFAULT") + } + + if !s.Treatacres.IsUnset() { + vals[41] = psql.Arg(s.Treatacres.MustGetNull()) + } else { + vals[41] = psql.Raw("DEFAULT") + } + + if !s.Treatarea.IsUnset() { + vals[42] = psql.Arg(s.Treatarea.MustGetNull()) + } else { + vals[42] = psql.Raw("DEFAULT") + } + + if !s.Treathectares.IsUnset() { + vals[43] = psql.Arg(s.Treathectares.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if !s.Treatmenthours.IsUnset() { + vals[44] = psql.Arg(s.Treatmenthours.MustGetNull()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if !s.Treatmentlength.IsUnset() { + vals[45] = psql.Arg(s.Treatmentlength.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if !s.Treatmentlengthunits.IsUnset() { + vals[46] = psql.Arg(s.Treatmentlengthunits.MustGetNull()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if !s.Totalcostprodcut.IsUnset() { + vals[47] = psql.Arg(s.Totalcostprodcut.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if !s.Ulvrouteid.IsUnset() { + vals[48] = psql.Arg(s.Ulvrouteid.MustGetNull()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if !s.Warningoverride.IsUnset() { + vals[49] = psql.Arg(s.Warningoverride.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if !s.Winddir.IsUnset() { + vals[50] = psql.Arg(s.Winddir.MustGetNull()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if !s.Windspeed.IsUnset() { + vals[51] = psql.Arg(s.Windspeed.MustGetNull()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + + if !s.Zone.IsUnset() { + vals[52] = psql.Arg(s.Zone.MustGetNull()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + + if !s.Zone2.IsUnset() { + vals[53] = psql.Arg(s.Zone2.MustGetNull()) + } else { + vals[53] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[54] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[54] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[55] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if !s.TempSitecond.IsUnset() { + vals[56] = psql.Arg(s.TempSitecond.MustGetNull()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[57] = psql.Arg(s.Version.MustGet()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryTreatmentSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 58) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Activity.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "activity")...), + psql.Arg(s.Activity), + }}) + } + + if !s.Areaunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "areaunit")...), + psql.Arg(s.Areaunit), + }}) + } + + if !s.Avetemp.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "avetemp")...), + psql.Arg(s.Avetemp), + }}) + } + + if !s.Barrierrouteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "barrierrouteid")...), + psql.Arg(s.Barrierrouteid), + }}) + } + + if !s.Cbcount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cbcount")...), + psql.Arg(s.Cbcount), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Containercount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "containercount")...), + psql.Arg(s.Containercount), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Enddatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "enddatetime")...), + psql.Arg(s.Enddatetime), + }}) + } + + if !s.Equiptype.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "equiptype")...), + psql.Arg(s.Equiptype), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Fieldtech.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldtech")...), + psql.Arg(s.Fieldtech), + }}) + } + + if !s.Flowrate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "flowrate")...), + psql.Arg(s.Flowrate), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Habitat.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "habitat")...), + psql.Arg(s.Habitat), + }}) + } + + if !s.InspID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "insp_id")...), + psql.Arg(s.InspID), + }}) + } + + if !s.Invloc.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "invloc")...), + psql.Arg(s.Invloc), + }}) + } + + if !s.Linelocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "linelocid")...), + psql.Arg(s.Linelocid), + }}) + } + + if !s.Locationname.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "locationname")...), + psql.Arg(s.Locationname), + }}) + } + + if !s.Method.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "method")...), + psql.Arg(s.Method), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.Pointlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "pointlocid")...), + psql.Arg(s.Pointlocid), + }}) + } + + if !s.Polygonlocid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "polygonlocid")...), + psql.Arg(s.Polygonlocid), + }}) + } + + if !s.Product.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "product")...), + psql.Arg(s.Product), + }}) + } + + if !s.Ptaid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ptaid")...), + psql.Arg(s.Ptaid), + }}) + } + + if !s.Qty.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "qty")...), + psql.Arg(s.Qty), + }}) + } + + if !s.Qtyunit.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "qtyunit")...), + psql.Arg(s.Qtyunit), + }}) + } + + if !s.Raingauge.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "raingauge")...), + psql.Arg(s.Raingauge), + }}) + } + + if !s.Recordstatus.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "recordstatus")...), + psql.Arg(s.Recordstatus), + }}) + } + + if !s.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.Reviewedby.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewedby")...), + psql.Arg(s.Reviewedby), + }}) + } + + if !s.Revieweddate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "revieweddate")...), + psql.Arg(s.Revieweddate), + }}) + } + + if !s.Sdid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sdid")...), + psql.Arg(s.Sdid), + }}) + } + + if !s.Sitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "sitecond")...), + psql.Arg(s.Sitecond), + }}) + } + + if !s.Srid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.Startdatetime.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "startdatetime")...), + psql.Arg(s.Startdatetime), + }}) + } + + if !s.Targetspecies.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "targetspecies")...), + psql.Arg(s.Targetspecies), + }}) + } + + if !s.Tirecount.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "tirecount")...), + psql.Arg(s.Tirecount), + }}) + } + + if !s.Treatacres.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatacres")...), + psql.Arg(s.Treatacres), + }}) + } + + if !s.Treatarea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatarea")...), + psql.Arg(s.Treatarea), + }}) + } + + if !s.Treathectares.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treathectares")...), + psql.Arg(s.Treathectares), + }}) + } + + if !s.Treatmenthours.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmenthours")...), + psql.Arg(s.Treatmenthours), + }}) + } + + if !s.Treatmentlength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentlength")...), + psql.Arg(s.Treatmentlength), + }}) + } + + if !s.Treatmentlengthunits.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatmentlengthunits")...), + psql.Arg(s.Treatmentlengthunits), + }}) + } + + if !s.Totalcostprodcut.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "totalcostprodcut")...), + psql.Arg(s.Totalcostprodcut), + }}) + } + + if !s.Ulvrouteid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "ulvrouteid")...), + psql.Arg(s.Ulvrouteid), + }}) + } + + if !s.Warningoverride.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "warningoverride")...), + psql.Arg(s.Warningoverride), + }}) + } + + if !s.Winddir.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "winddir")...), + psql.Arg(s.Winddir), + }}) + } + + if !s.Windspeed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "windspeed")...), + psql.Arg(s.Windspeed), + }}) + } + + if !s.Zone.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone")...), + psql.Arg(s.Zone), + }}) + } + + if !s.Zone2.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "zone2")...), + psql.Arg(s.Zone2), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.TempSitecond.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "temp_sitecond")...), + psql.Arg(s.TempSitecond), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryTreatment retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryTreatment(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTreatment, error) { + if len(cols) == 0 { + return HistoryTreatments.Query( + sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryTreatments.Query( + sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryTreatments.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryTreatmentExists checks the presence of a single record by primary key +func HistoryTreatmentExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryTreatments.Query( + sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryTreatment is retrieved from the database +func (o *HistoryTreatment) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTreatments.AfterSelectHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryTreatments.AfterInsertHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryTreatment +func (o *HistoryTreatment) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryTreatment) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_treatment", "objectid"), psql.Quote("history_treatment", "version")).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 HistoryTreatment +func (o *HistoryTreatment) Update(ctx context.Context, exec bob.Executor, s *HistoryTreatmentSetter) error { + v, err := HistoryTreatments.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 HistoryTreatment record with an executor +func (o *HistoryTreatment) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryTreatments.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryTreatment using the executor +func (o *HistoryTreatment) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryTreatments.Query( + sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryTreatmentSlice is retrieved from the database +func (o HistoryTreatmentSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTreatments.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryTreatments.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryTreatmentSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_treatment", "objectid"), psql.Quote("history_treatment", "version")).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 HistoryTreatmentSlice) copyMatchingRows(from ...*HistoryTreatment) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryTreatmentSlice) 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 HistoryTreatments.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 *HistoryTreatment: + o.copyMatchingRows(retrieved) + case []*HistoryTreatment: + o.copyMatchingRows(retrieved...) + case HistoryTreatmentSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTreatment or a slice of HistoryTreatment + // then run the AfterUpdateHooks on the slice + _, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryTreatmentSlice) 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 HistoryTreatments.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 *HistoryTreatment: + o.copyMatchingRows(retrieved) + case []*HistoryTreatment: + o.copyMatchingRows(retrieved...) + case HistoryTreatmentSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTreatment or a slice of HistoryTreatment + // then run the AfterDeleteHooks on the slice + _, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryTreatmentSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTreatmentSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTreatments.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryTreatmentSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTreatments.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryTreatmentSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryTreatments.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 *HistoryTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatment0 *HistoryTreatment, organization1 *Organization) (*HistoryTreatment, error) { + setter := &HistoryTreatmentSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyTreatment0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryTreatmentOrganization0: %w", err) + } + + return historyTreatment0, nil +} + +func (historyTreatment0 *HistoryTreatment) 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 = attachHistoryTreatmentOrganization0(ctx, exec, 1, historyTreatment0, organization1) + if err != nil { + return err + } + + historyTreatment0.R.Organization = organization1 + + organization1.R.HistoryTreatments = append(organization1.R.HistoryTreatments, historyTreatment0) + + return nil +} + +func (historyTreatment0 *HistoryTreatment) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryTreatmentOrganization0(ctx, exec, 1, historyTreatment0, organization1) + if err != nil { + return err + } + + historyTreatment0.R.Organization = organization1 + + organization1.R.HistoryTreatments = append(organization1.R.HistoryTreatments, historyTreatment0) + + return nil +} + +type historyTreatmentWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Activity psql.WhereNullMod[Q, string] + Areaunit psql.WhereNullMod[Q, string] + Avetemp psql.WhereNullMod[Q, float64] + Barrierrouteid psql.WhereNullMod[Q, string] + Cbcount psql.WhereNullMod[Q, int16] + Comments psql.WhereNullMod[Q, string] + Containercount psql.WhereNullMod[Q, int16] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Enddatetime psql.WhereNullMod[Q, int64] + Equiptype psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Fieldtech psql.WhereNullMod[Q, string] + Flowrate psql.WhereNullMod[Q, float64] + Globalid psql.WhereNullMod[Q, string] + Habitat psql.WhereNullMod[Q, string] + InspID psql.WhereNullMod[Q, string] + Invloc psql.WhereNullMod[Q, string] + Linelocid psql.WhereNullMod[Q, string] + Locationname psql.WhereNullMod[Q, string] + Method psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + Pointlocid psql.WhereNullMod[Q, string] + Polygonlocid psql.WhereNullMod[Q, string] + Product psql.WhereNullMod[Q, string] + Ptaid psql.WhereNullMod[Q, string] + Qty psql.WhereNullMod[Q, float64] + Qtyunit psql.WhereNullMod[Q, string] + Raingauge psql.WhereNullMod[Q, float64] + Recordstatus psql.WhereNullMod[Q, int16] + Reviewed psql.WhereNullMod[Q, int16] + Reviewedby psql.WhereNullMod[Q, string] + Revieweddate psql.WhereNullMod[Q, int64] + Sdid psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, string] + Startdatetime psql.WhereNullMod[Q, int64] + Targetspecies psql.WhereNullMod[Q, string] + Tirecount psql.WhereNullMod[Q, int16] + Treatacres psql.WhereNullMod[Q, float64] + Treatarea psql.WhereNullMod[Q, float64] + Treathectares psql.WhereNullMod[Q, float64] + Treatmenthours psql.WhereNullMod[Q, float64] + Treatmentlength psql.WhereNullMod[Q, float64] + Treatmentlengthunits psql.WhereNullMod[Q, string] + Totalcostprodcut psql.WhereNullMod[Q, float64] + Ulvrouteid psql.WhereNullMod[Q, string] + Warningoverride psql.WhereNullMod[Q, int16] + Winddir psql.WhereNullMod[Q, string] + Windspeed psql.WhereNullMod[Q, float64] + Zone psql.WhereNullMod[Q, string] + Zone2 psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + TempSitecond psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyTreatmentWhere[Q]) AliasedAs(alias string) historyTreatmentWhere[Q] { + return buildHistoryTreatmentWhere[Q](buildHistoryTreatmentColumns(alias)) +} + +func buildHistoryTreatmentWhere[Q psql.Filterable](cols historyTreatmentColumns) historyTreatmentWhere[Q] { + return historyTreatmentWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Barrierrouteid: psql.WhereNull[Q, string](cols.Barrierrouteid), + Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), + Comments: psql.WhereNull[Q, string](cols.Comments), + Containercount: psql.WhereNull[Q, int16](cols.Containercount), + Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), + Creator: psql.WhereNull[Q, string](cols.Creator), + Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), + Flowrate: psql.WhereNull[Q, float64](cols.Flowrate), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + InspID: psql.WhereNull[Q, string](cols.InspID), + Invloc: psql.WhereNull[Q, string](cols.Invloc), + Linelocid: psql.WhereNull[Q, string](cols.Linelocid), + Locationname: psql.WhereNull[Q, string](cols.Locationname), + Method: psql.WhereNull[Q, string](cols.Method), + Objectid: psql.Where[Q, int32](cols.Objectid), + Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), + Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), + Product: psql.WhereNull[Q, string](cols.Product), + Ptaid: psql.WhereNull[Q, string](cols.Ptaid), + Qty: psql.WhereNull[Q, float64](cols.Qty), + Qtyunit: psql.WhereNull[Q, string](cols.Qtyunit), + Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), + Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), + Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), + Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), + Sdid: psql.WhereNull[Q, string](cols.Sdid), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), + Srid: psql.WhereNull[Q, string](cols.Srid), + Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), + Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), + Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), + Treatacres: psql.WhereNull[Q, float64](cols.Treatacres), + Treatarea: psql.WhereNull[Q, float64](cols.Treatarea), + Treathectares: psql.WhereNull[Q, float64](cols.Treathectares), + Treatmenthours: psql.WhereNull[Q, float64](cols.Treatmenthours), + Treatmentlength: psql.WhereNull[Q, float64](cols.Treatmentlength), + Treatmentlengthunits: psql.WhereNull[Q, string](cols.Treatmentlengthunits), + Totalcostprodcut: psql.WhereNull[Q, float64](cols.Totalcostprodcut), + Ulvrouteid: psql.WhereNull[Q, string](cols.Ulvrouteid), + Warningoverride: psql.WhereNull[Q, int16](cols.Warningoverride), + Winddir: psql.WhereNull[Q, string](cols.Winddir), + Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), + Zone: psql.WhereNull[Q, string](cols.Zone), + Zone2: psql.WhereNull[Q, string](cols.Zone2), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + TempSitecond: psql.WhereNull[Q, string](cols.TempSitecond), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryTreatment) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyTreatment cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryTreatments = HistoryTreatmentSlice{o} + } + return nil + default: + return fmt.Errorf("historyTreatment has no relationship %q", name) + } +} + +type historyTreatmentPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryTreatmentPreloader() historyTreatmentPreloader { + return historyTreatmentPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryTreatments, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyTreatmentThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryTreatmentThenLoader[Q orm.Loadable]() historyTreatmentThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyTreatmentThenLoader[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 historyTreatment's Organization into the .R struct +func (o *HistoryTreatment) 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.HistoryTreatments = HistoryTreatmentSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyTreatment's Organization into the .R struct +func (os HistoryTreatmentSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryTreatments = append(rel.R.HistoryTreatments, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyTreatmentJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyTreatmentJoins[Q]) aliasedAs(alias string) historyTreatmentJoins[Q] { + return buildHistoryTreatmentJoins[Q](buildHistoryTreatmentColumns(alias), j.typ) +} + +func buildHistoryTreatmentJoins[Q dialect.Joinable](cols historyTreatmentColumns, typ string) historyTreatmentJoins[Q] { + return historyTreatmentJoins[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/history_treatmentarea.bob.go b/models/history_treatmentarea.bob.go new file mode 100644 index 00000000..65e16442 --- /dev/null +++ b/models/history_treatmentarea.bob.go @@ -0,0 +1,1117 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyTreatmentareaR `db:"-" ` +} + +// HistoryTreatmentareaSlice is an alias for a slice of pointers to HistoryTreatmentarea. +// This should almost always be used instead of []*HistoryTreatmentarea. +type HistoryTreatmentareaSlice []*HistoryTreatmentarea + +// HistoryTreatmentareas contains methods to work with the history_treatmentarea table +var HistoryTreatmentareas = psql.NewTablex[*HistoryTreatmentarea, HistoryTreatmentareaSlice, *HistoryTreatmentareaSetter]("", "history_treatmentarea", buildHistoryTreatmentareaColumns("history_treatmentarea")) + +// HistoryTreatmentareasQuery is a query on the history_treatmentarea table +type HistoryTreatmentareasQuery = *psql.ViewQuery[*HistoryTreatmentarea, HistoryTreatmentareaSlice] + +// historyTreatmentareaR is where relationships are stored. +type historyTreatmentareaR struct { + Organization *Organization // history_treatmentarea.history_treatmentarea_organization_id_fkey +} + +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", + ).WithParent("history_treatmentarea"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Comments: psql.Quote(alias, "comments"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Notified: psql.Quote(alias, "notified"), + Objectid: psql.Quote(alias, "objectid"), + SessionID: psql.Quote(alias, "session_id"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + Treatdate: psql.Quote(alias, "treatdate"), + TreatID: psql.Quote(alias, "treat_id"), + Type: psql.Quote(alias, "type"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyTreatmentareaColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Comments psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Notified psql.Expression + Objectid psql.Expression + SessionID psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + Treatdate psql.Expression + TreatID psql.Expression + Type psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyTreatmentareaColumns) Alias() string { + return c.tableAlias +} + +func (historyTreatmentareaColumns) AliasedAs(alias string) historyTreatmentareaColumns { + return buildHistoryTreatmentareaColumns(alias) +} + +// HistoryTreatmentareaSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryTreatmentareaSetter) SetColumns() []string { + vals := make([]string, 0, 22) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Comments.IsUnset() { + vals = append(vals, "comments") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Notified.IsUnset() { + vals = append(vals, "notified") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.SessionID.IsUnset() { + vals = append(vals, "session_id") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.Treatdate.IsUnset() { + vals = append(vals, "treatdate") + } + if !s.TreatID.IsUnset() { + vals = append(vals, "treat_id") + } + if !s.Type.IsUnset() { + vals = append(vals, "type") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryTreatmentareaSetter) Overwrite(t *HistoryTreatmentarea) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Comments.IsUnset() { + t.Comments = s.Comments.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Notified.IsUnset() { + t.Notified = s.Notified.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.SessionID.IsUnset() { + t.SessionID = s.SessionID.MustGetNull() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.Treatdate.IsUnset() { + t.Treatdate = s.Treatdate.MustGetNull() + } + if !s.TreatID.IsUnset() { + t.TreatID = s.TreatID.MustGetNull() + } + if !s.Type.IsUnset() { + t.Type = s.Type.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryTreatmentareaSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryTreatmentareas.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, 22) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Comments.IsUnset() { + vals[1] = psql.Arg(s.Comments.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Notified.IsUnset() { + vals[7] = psql.Arg(s.Notified.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.SessionID.IsUnset() { + vals[9] = psql.Arg(s.SessionID.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[10] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[11] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.Treatdate.IsUnset() { + vals[12] = psql.Arg(s.Treatdate.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.TreatID.IsUnset() { + vals[13] = psql.Arg(s.TreatID.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.Type.IsUnset() { + vals[14] = psql.Arg(s.Type.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[15] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[16] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[17] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[18] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[19] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if !s.LastEditedUser.IsUnset() { + vals[20] = psql.Arg(s.LastEditedUser.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[21] = psql.Arg(s.Version.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s HistoryTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 22) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Comments.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "comments")...), + psql.Arg(s.Comments), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Notified.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "notified")...), + psql.Arg(s.Notified), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.SessionID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "session_id")...), + psql.Arg(s.SessionID), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.Treatdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treatdate")...), + psql.Arg(s.Treatdate), + }}) + } + + if !s.TreatID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "treat_id")...), + psql.Arg(s.TreatID), + }}) + } + + if !s.Type.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type")...), + psql.Arg(s.Type), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryTreatmentarea retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTreatmentarea, error) { + if len(cols) == 0 { + return HistoryTreatmentareas.Query( + sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryTreatmentareas.Query( + sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryTreatmentareas.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryTreatmentareaExists checks the presence of a single record by primary key +func HistoryTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryTreatmentareas.Query( + sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryTreatmentarea is retrieved from the database +func (o *HistoryTreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryTreatmentarea +func (o *HistoryTreatmentarea) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryTreatmentarea) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_treatmentarea", "objectid"), psql.Quote("history_treatmentarea", "version")).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 HistoryTreatmentarea +func (o *HistoryTreatmentarea) Update(ctx context.Context, exec bob.Executor, s *HistoryTreatmentareaSetter) error { + v, err := HistoryTreatmentareas.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 HistoryTreatmentarea record with an executor +func (o *HistoryTreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryTreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryTreatmentarea using the executor +func (o *HistoryTreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryTreatmentareas.Query( + sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryTreatmentareaSlice is retrieved from the database +func (o HistoryTreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryTreatmentareaSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_treatmentarea", "objectid"), psql.Quote("history_treatmentarea", "version")).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 HistoryTreatmentareaSlice) copyMatchingRows(from ...*HistoryTreatmentarea) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryTreatmentareaSlice) 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 HistoryTreatmentareas.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 *HistoryTreatmentarea: + o.copyMatchingRows(retrieved) + case []*HistoryTreatmentarea: + o.copyMatchingRows(retrieved...) + case HistoryTreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTreatmentarea or a slice of HistoryTreatmentarea + // then run the AfterUpdateHooks on the slice + _, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryTreatmentareaSlice) 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 HistoryTreatmentareas.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 *HistoryTreatmentarea: + o.copyMatchingRows(retrieved) + case []*HistoryTreatmentarea: + o.copyMatchingRows(retrieved...) + case HistoryTreatmentareaSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryTreatmentarea or a slice of HistoryTreatmentarea + // then run the AfterDeleteHooks on the slice + _, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryTreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTreatmentareaSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryTreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryTreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryTreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryTreatmentareas.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 *HistoryTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatmentarea0 *HistoryTreatmentarea, organization1 *Organization) (*HistoryTreatmentarea, error) { + setter := &HistoryTreatmentareaSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyTreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryTreatmentareaOrganization0: %w", err) + } + + return historyTreatmentarea0, nil +} + +func (historyTreatmentarea0 *HistoryTreatmentarea) 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 = attachHistoryTreatmentareaOrganization0(ctx, exec, 1, historyTreatmentarea0, organization1) + if err != nil { + return err + } + + historyTreatmentarea0.R.Organization = organization1 + + organization1.R.HistoryTreatmentareas = append(organization1.R.HistoryTreatmentareas, historyTreatmentarea0) + + return nil +} + +func (historyTreatmentarea0 *HistoryTreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryTreatmentareaOrganization0(ctx, exec, 1, historyTreatmentarea0, organization1) + if err != nil { + return err + } + + historyTreatmentarea0.R.Organization = organization1 + + organization1.R.HistoryTreatmentareas = append(organization1.R.HistoryTreatmentareas, historyTreatmentarea0) + + return nil +} + +type historyTreatmentareaWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Comments psql.WhereNullMod[Q, string] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Notified psql.WhereNullMod[Q, int16] + Objectid psql.WhereMod[Q, int32] + SessionID psql.WhereNullMod[Q, string] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + Treatdate psql.WhereNullMod[Q, int64] + TreatID psql.WhereNullMod[Q, string] + Type psql.WhereNullMod[Q, string] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyTreatmentareaWhere[Q]) AliasedAs(alias string) historyTreatmentareaWhere[Q] { + return buildHistoryTreatmentareaWhere[Q](buildHistoryTreatmentareaColumns(alias)) +} + +func buildHistoryTreatmentareaWhere[Q psql.Filterable](cols historyTreatmentareaColumns) historyTreatmentareaWhere[Q] { + return historyTreatmentareaWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Notified: psql.WhereNull[Q, int16](cols.Notified), + Objectid: psql.Where[Q, int32](cols.Objectid), + SessionID: psql.WhereNull[Q, string](cols.SessionID), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Treatdate: psql.WhereNull[Q, int64](cols.Treatdate), + TreatID: psql.WhereNull[Q, string](cols.TreatID), + Type: psql.WhereNull[Q, string](cols.Type), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryTreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyTreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryTreatmentareas = HistoryTreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("historyTreatmentarea has no relationship %q", name) + } +} + +type historyTreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryTreatmentareaPreloader() historyTreatmentareaPreloader { + return historyTreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryTreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyTreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryTreatmentareaThenLoader[Q orm.Loadable]() historyTreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyTreatmentareaThenLoader[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 historyTreatmentarea's Organization into the .R struct +func (o *HistoryTreatmentarea) 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.HistoryTreatmentareas = HistoryTreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyTreatmentarea's Organization into the .R struct +func (os HistoryTreatmentareaSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryTreatmentareas = append(rel.R.HistoryTreatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyTreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyTreatmentareaJoins[Q]) aliasedAs(alias string) historyTreatmentareaJoins[Q] { + return buildHistoryTreatmentareaJoins[Q](buildHistoryTreatmentareaColumns(alias), j.typ) +} + +func buildHistoryTreatmentareaJoins[Q dialect.Joinable](cols historyTreatmentareaColumns, typ string) historyTreatmentareaJoins[Q] { + return historyTreatmentareaJoins[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/history_zones.bob.go b/models/history_zones.bob.go new file mode 100644 index 00000000..499fb3a8 --- /dev/null +++ b/models/history_zones.bob.go @@ -0,0 +1,1017 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyZoneR `db:"-" ` +} + +// HistoryZoneSlice is an alias for a slice of pointers to HistoryZone. +// This should almost always be used instead of []*HistoryZone. +type HistoryZoneSlice []*HistoryZone + +// HistoryZones contains methods to work with the history_zones table +var HistoryZones = psql.NewTablex[*HistoryZone, HistoryZoneSlice, *HistoryZoneSetter]("", "history_zones", buildHistoryZoneColumns("history_zones")) + +// HistoryZonesQuery is a query on the history_zones table +type HistoryZonesQuery = *psql.ViewQuery[*HistoryZone, HistoryZoneSlice] + +// historyZoneR is where relationships are stored. +type historyZoneR struct { + Organization *Organization // history_zones.history_zones_organization_id_fkey +} + +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", + ).WithParent("history_zones"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Active: psql.Quote(alias, "active"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyZoneColumns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Active psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Name psql.Expression + Objectid psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyZoneColumns) Alias() string { + return c.tableAlias +} + +func (historyZoneColumns) AliasedAs(alias string) historyZoneColumns { + return buildHistoryZoneColumns(alias) +} + +// HistoryZoneSetter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryZoneSetter) SetColumns() []string { + vals := make([]string, 0, 18) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Active.IsUnset() { + vals = append(vals, "active") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryZoneSetter) Overwrite(t *HistoryZone) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Active.IsUnset() { + t.Active = s.Active.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryZoneSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryZones.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, 18) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Active.IsUnset() { + vals[1] = psql.Arg(s.Active.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[2] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[3] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[4] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[5] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[6] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[7] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[8] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[9] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[10] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryZoneSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 18) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Active.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "active")...), + psql.Arg(s.Active), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryZone retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryZone(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryZone, error) { + if len(cols) == 0 { + return HistoryZones.Query( + sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryZones.Query( + sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryZones.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryZoneExists checks the presence of a single record by primary key +func HistoryZoneExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryZones.Query( + sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryZone is retrieved from the database +func (o *HistoryZone) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryZones.AfterSelectHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryZones.AfterInsertHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryZone +func (o *HistoryZone) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryZone) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_zones", "objectid"), psql.Quote("history_zones", "version")).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 HistoryZone +func (o *HistoryZone) Update(ctx context.Context, exec bob.Executor, s *HistoryZoneSetter) error { + v, err := HistoryZones.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 HistoryZone record with an executor +func (o *HistoryZone) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryZones.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryZone using the executor +func (o *HistoryZone) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryZones.Query( + sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryZoneSlice is retrieved from the database +func (o HistoryZoneSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryZones.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryZones.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryZoneSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_zones", "objectid"), psql.Quote("history_zones", "version")).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 HistoryZoneSlice) copyMatchingRows(from ...*HistoryZone) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryZoneSlice) 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 HistoryZones.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 *HistoryZone: + o.copyMatchingRows(retrieved) + case []*HistoryZone: + o.copyMatchingRows(retrieved...) + case HistoryZoneSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryZone or a slice of HistoryZone + // then run the AfterUpdateHooks on the slice + _, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryZoneSlice) 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 HistoryZones.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 *HistoryZone: + o.copyMatchingRows(retrieved) + case []*HistoryZone: + o.copyMatchingRows(retrieved...) + case HistoryZoneSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryZone or a slice of HistoryZone + // then run the AfterDeleteHooks on the slice + _, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryZoneSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryZoneSetter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryZones.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryZoneSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryZones.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryZoneSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryZones.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 *HistoryZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryZoneOrganization0(ctx context.Context, exec bob.Executor, count int, historyZone0 *HistoryZone, organization1 *Organization) (*HistoryZone, error) { + setter := &HistoryZoneSetter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyZone0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryZoneOrganization0: %w", err) + } + + return historyZone0, nil +} + +func (historyZone0 *HistoryZone) 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 = attachHistoryZoneOrganization0(ctx, exec, 1, historyZone0, organization1) + if err != nil { + return err + } + + historyZone0.R.Organization = organization1 + + organization1.R.HistoryZones = append(organization1.R.HistoryZones, historyZone0) + + return nil +} + +func (historyZone0 *HistoryZone) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryZoneOrganization0(ctx, exec, 1, historyZone0, organization1) + if err != nil { + return err + } + + historyZone0.R.Organization = organization1 + + organization1.R.HistoryZones = append(organization1.R.HistoryZones, historyZone0) + + return nil +} + +type historyZoneWhere[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Active psql.WhereNullMod[Q, int64] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyZoneWhere[Q]) AliasedAs(alias string) historyZoneWhere[Q] { + return buildHistoryZoneWhere[Q](buildHistoryZoneColumns(alias)) +} + +func buildHistoryZoneWhere[Q psql.Filterable](cols historyZoneColumns) historyZoneWhere[Q] { + return historyZoneWhere[Q]{ + OrganizationID: psql.WhereNull[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), + Editdate: psql.WhereNull[Q, int64](cols.Editdate), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryZone) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyZone cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryZones = HistoryZoneSlice{o} + } + return nil + default: + return fmt.Errorf("historyZone has no relationship %q", name) + } +} + +type historyZonePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryZonePreloader() historyZonePreloader { + return historyZonePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryZones, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyZoneThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryZoneThenLoader[Q orm.Loadable]() historyZoneThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyZoneThenLoader[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 historyZone's Organization into the .R struct +func (o *HistoryZone) 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.HistoryZones = HistoryZoneSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyZone's Organization into the .R struct +func (os HistoryZoneSlice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryZones = append(rel.R.HistoryZones, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyZoneJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyZoneJoins[Q]) aliasedAs(alias string) historyZoneJoins[Q] { + return buildHistoryZoneJoins[Q](buildHistoryZoneColumns(alias), j.typ) +} + +func buildHistoryZoneJoins[Q dialect.Joinable](cols historyZoneColumns, typ string) historyZoneJoins[Q] { + return historyZoneJoins[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/history_zones2.bob.go b/models/history_zones2.bob.go new file mode 100644 index 00000000..beb0a935 --- /dev/null +++ b/models/history_zones2.bob.go @@ -0,0 +1,992 @@ +// 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" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "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" +) + +// 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" ` + + R historyZones2R `db:"-" ` +} + +// HistoryZones2Slice is an alias for a slice of pointers to HistoryZones2. +// This should almost always be used instead of []*HistoryZones2. +type HistoryZones2Slice []*HistoryZones2 + +// HistoryZones2s contains methods to work with the history_zones2 table +var HistoryZones2s = psql.NewTablex[*HistoryZones2, HistoryZones2Slice, *HistoryZones2Setter]("", "history_zones2", buildHistoryZones2Columns("history_zones2")) + +// HistoryZones2sQuery is a query on the history_zones2 table +type HistoryZones2sQuery = *psql.ViewQuery[*HistoryZones2, HistoryZones2Slice] + +// historyZones2R is where relationships are stored. +type historyZones2R struct { + Organization *Organization // history_zones2.history_zones2_organization_id_fkey +} + +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", + ).WithParent("history_zones2"), + tableAlias: alias, + OrganizationID: psql.Quote(alias, "organization_id"), + Creationdate: psql.Quote(alias, "creationdate"), + Creator: psql.Quote(alias, "creator"), + Editdate: psql.Quote(alias, "editdate"), + Editor: psql.Quote(alias, "editor"), + Globalid: psql.Quote(alias, "globalid"), + Name: psql.Quote(alias, "name"), + Objectid: psql.Quote(alias, "objectid"), + ShapeArea: psql.Quote(alias, "shape__area"), + ShapeLength: psql.Quote(alias, "shape__length"), + CreatedDate: psql.Quote(alias, "created_date"), + CreatedUser: psql.Quote(alias, "created_user"), + GeometryX: psql.Quote(alias, "geometry_x"), + GeometryY: psql.Quote(alias, "geometry_y"), + LastEditedDate: psql.Quote(alias, "last_edited_date"), + LastEditedUser: psql.Quote(alias, "last_edited_user"), + Version: psql.Quote(alias, "version"), + } +} + +type historyZones2Columns struct { + expr.ColumnsExpr + tableAlias string + OrganizationID psql.Expression + Creationdate psql.Expression + Creator psql.Expression + Editdate psql.Expression + Editor psql.Expression + Globalid psql.Expression + Name psql.Expression + Objectid psql.Expression + ShapeArea psql.Expression + ShapeLength psql.Expression + CreatedDate psql.Expression + CreatedUser psql.Expression + GeometryX psql.Expression + GeometryY psql.Expression + LastEditedDate psql.Expression + LastEditedUser psql.Expression + Version psql.Expression +} + +func (c historyZones2Columns) Alias() string { + return c.tableAlias +} + +func (historyZones2Columns) AliasedAs(alias string) historyZones2Columns { + return buildHistoryZones2Columns(alias) +} + +// HistoryZones2Setter is used for insert/upsert/update operations +// 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" ` +} + +func (s HistoryZones2Setter) SetColumns() []string { + vals := make([]string, 0, 17) + if !s.OrganizationID.IsUnset() { + vals = append(vals, "organization_id") + } + if !s.Creationdate.IsUnset() { + vals = append(vals, "creationdate") + } + if !s.Creator.IsUnset() { + vals = append(vals, "creator") + } + if !s.Editdate.IsUnset() { + vals = append(vals, "editdate") + } + if !s.Editor.IsUnset() { + vals = append(vals, "editor") + } + if !s.Globalid.IsUnset() { + vals = append(vals, "globalid") + } + if !s.Name.IsUnset() { + vals = append(vals, "name") + } + if s.Objectid.IsValue() { + vals = append(vals, "objectid") + } + if !s.ShapeArea.IsUnset() { + vals = append(vals, "shape__area") + } + if !s.ShapeLength.IsUnset() { + vals = append(vals, "shape__length") + } + if !s.CreatedDate.IsUnset() { + vals = append(vals, "created_date") + } + if !s.CreatedUser.IsUnset() { + vals = append(vals, "created_user") + } + if !s.GeometryX.IsUnset() { + vals = append(vals, "geometry_x") + } + if !s.GeometryY.IsUnset() { + vals = append(vals, "geometry_y") + } + if !s.LastEditedDate.IsUnset() { + vals = append(vals, "last_edited_date") + } + if !s.LastEditedUser.IsUnset() { + vals = append(vals, "last_edited_user") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + return vals +} + +func (s HistoryZones2Setter) Overwrite(t *HistoryZones2) { + if !s.OrganizationID.IsUnset() { + t.OrganizationID = s.OrganizationID.MustGetNull() + } + if !s.Creationdate.IsUnset() { + t.Creationdate = s.Creationdate.MustGetNull() + } + if !s.Creator.IsUnset() { + t.Creator = s.Creator.MustGetNull() + } + if !s.Editdate.IsUnset() { + t.Editdate = s.Editdate.MustGetNull() + } + if !s.Editor.IsUnset() { + t.Editor = s.Editor.MustGetNull() + } + if !s.Globalid.IsUnset() { + t.Globalid = s.Globalid.MustGetNull() + } + if !s.Name.IsUnset() { + t.Name = s.Name.MustGetNull() + } + if s.Objectid.IsValue() { + t.Objectid = s.Objectid.MustGet() + } + if !s.ShapeArea.IsUnset() { + t.ShapeArea = s.ShapeArea.MustGetNull() + } + if !s.ShapeLength.IsUnset() { + t.ShapeLength = s.ShapeLength.MustGetNull() + } + if !s.CreatedDate.IsUnset() { + t.CreatedDate = s.CreatedDate.MustGetNull() + } + if !s.CreatedUser.IsUnset() { + t.CreatedUser = s.CreatedUser.MustGetNull() + } + if !s.GeometryX.IsUnset() { + t.GeometryX = s.GeometryX.MustGetNull() + } + if !s.GeometryY.IsUnset() { + t.GeometryY = s.GeometryY.MustGetNull() + } + if !s.LastEditedDate.IsUnset() { + t.LastEditedDate = s.LastEditedDate.MustGetNull() + } + if !s.LastEditedUser.IsUnset() { + t.LastEditedUser = s.LastEditedUser.MustGetNull() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } +} + +func (s *HistoryZones2Setter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return HistoryZones2s.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, 17) + if !s.OrganizationID.IsUnset() { + vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Creationdate.IsUnset() { + vals[1] = psql.Arg(s.Creationdate.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Creator.IsUnset() { + vals[2] = psql.Arg(s.Creator.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Editdate.IsUnset() { + vals[3] = psql.Arg(s.Editdate.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Editor.IsUnset() { + vals[4] = psql.Arg(s.Editor.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.Globalid.IsUnset() { + vals[5] = psql.Arg(s.Globalid.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Name.IsUnset() { + vals[6] = psql.Arg(s.Name.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if s.Objectid.IsValue() { + vals[7] = psql.Arg(s.Objectid.MustGet()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if !s.ShapeArea.IsUnset() { + vals[8] = psql.Arg(s.ShapeArea.MustGetNull()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if !s.ShapeLength.IsUnset() { + vals[9] = psql.Arg(s.ShapeLength.MustGetNull()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + if !s.CreatedDate.IsUnset() { + vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) + } else { + vals[10] = psql.Raw("DEFAULT") + } + + if !s.CreatedUser.IsUnset() { + vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) + } else { + vals[11] = psql.Raw("DEFAULT") + } + + if !s.GeometryX.IsUnset() { + vals[12] = psql.Arg(s.GeometryX.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if !s.GeometryY.IsUnset() { + vals[13] = psql.Arg(s.GeometryY.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if !s.LastEditedDate.IsUnset() { + vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + 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, "", ", ", "") + })) +} + +func (s HistoryZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s HistoryZones2Setter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 17) + + if !s.OrganizationID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Creationdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creationdate")...), + psql.Arg(s.Creationdate), + }}) + } + + if !s.Creator.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator")...), + psql.Arg(s.Creator), + }}) + } + + if !s.Editdate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editdate")...), + psql.Arg(s.Editdate), + }}) + } + + if !s.Editor.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "editor")...), + psql.Arg(s.Editor), + }}) + } + + if !s.Globalid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "globalid")...), + psql.Arg(s.Globalid), + }}) + } + + if !s.Name.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "name")...), + psql.Arg(s.Name), + }}) + } + + if s.Objectid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "objectid")...), + psql.Arg(s.Objectid), + }}) + } + + if !s.ShapeArea.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__area")...), + psql.Arg(s.ShapeArea), + }}) + } + + if !s.ShapeLength.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "shape__length")...), + psql.Arg(s.ShapeLength), + }}) + } + + if !s.CreatedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_date")...), + psql.Arg(s.CreatedDate), + }}) + } + + if !s.CreatedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created_user")...), + psql.Arg(s.CreatedUser), + }}) + } + + if !s.GeometryX.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_x")...), + psql.Arg(s.GeometryX), + }}) + } + + if !s.GeometryY.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry_y")...), + psql.Arg(s.GeometryY), + }}) + } + + if !s.LastEditedDate.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_date")...), + psql.Arg(s.LastEditedDate), + }}) + } + + if !s.LastEditedUser.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "last_edited_user")...), + psql.Arg(s.LastEditedUser), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + return exprs +} + +// FindHistoryZones2 retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindHistoryZones2(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryZones2, error) { + if len(cols) == 0 { + return HistoryZones2s.Query( + sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), + ).One(ctx, exec) + } + + return HistoryZones2s.Query( + sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Columns(HistoryZones2s.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// HistoryZones2Exists checks the presence of a single record by primary key +func HistoryZones2Exists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { + return HistoryZones2s.Query( + sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), + sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after HistoryZones2 is retrieved from the database +func (o *HistoryZones2) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryZones2s.AfterSelectHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) + case bob.QueryTypeInsert: + ctx, err = HistoryZones2s.AfterInsertHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) + case bob.QueryTypeUpdate: + ctx, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) + case bob.QueryTypeDelete: + ctx, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the HistoryZones2 +func (o *HistoryZones2) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Objectid, + o.Version, + ) +} + +func (o *HistoryZones2) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("history_zones2", "objectid"), psql.Quote("history_zones2", "version")).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 HistoryZones2 +func (o *HistoryZones2) Update(ctx context.Context, exec bob.Executor, s *HistoryZones2Setter) error { + v, err := HistoryZones2s.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 HistoryZones2 record with an executor +func (o *HistoryZones2) Delete(ctx context.Context, exec bob.Executor) error { + _, err := HistoryZones2s.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the HistoryZones2 using the executor +func (o *HistoryZones2) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := HistoryZones2s.Query( + sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(o.Objectid))), + sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(o.Version))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after HistoryZones2Slice is retrieved from the database +func (o HistoryZones2Slice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = HistoryZones2s.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = HistoryZones2s.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o HistoryZones2Slice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("history_zones2", "objectid"), psql.Quote("history_zones2", "version")).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 HistoryZones2Slice) copyMatchingRows(from ...*HistoryZones2) { + for i, old := range o { + for _, new := range from { + if new.Objectid != old.Objectid { + continue + } + if new.Version != old.Version { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o HistoryZones2Slice) 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 HistoryZones2s.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 *HistoryZones2: + o.copyMatchingRows(retrieved) + case []*HistoryZones2: + o.copyMatchingRows(retrieved...) + case HistoryZones2Slice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryZones2 or a slice of HistoryZones2 + // then run the AfterUpdateHooks on the slice + _, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o HistoryZones2Slice) 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 HistoryZones2s.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 *HistoryZones2: + o.copyMatchingRows(retrieved) + case []*HistoryZones2: + o.copyMatchingRows(retrieved...) + case HistoryZones2Slice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a HistoryZones2 or a slice of HistoryZones2 + // then run the AfterDeleteHooks on the slice + _, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o HistoryZones2Slice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryZones2Setter) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryZones2s.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o HistoryZones2Slice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := HistoryZones2s.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o HistoryZones2Slice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := HistoryZones2s.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 *HistoryZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os HistoryZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[null.Val[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 attachHistoryZones2Organization0(ctx context.Context, exec bob.Executor, count int, historyZones20 *HistoryZones2, organization1 *Organization) (*HistoryZones2, error) { + setter := &HistoryZones2Setter{ + OrganizationID: omitnull.From(organization1.ID), + } + + err := historyZones20.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachHistoryZones2Organization0: %w", err) + } + + return historyZones20, nil +} + +func (historyZones20 *HistoryZones2) 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 = attachHistoryZones2Organization0(ctx, exec, 1, historyZones20, organization1) + if err != nil { + return err + } + + historyZones20.R.Organization = organization1 + + organization1.R.HistoryZones2s = append(organization1.R.HistoryZones2s, historyZones20) + + return nil +} + +func (historyZones20 *HistoryZones2) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachHistoryZones2Organization0(ctx, exec, 1, historyZones20, organization1) + if err != nil { + return err + } + + historyZones20.R.Organization = organization1 + + organization1.R.HistoryZones2s = append(organization1.R.HistoryZones2s, historyZones20) + + return nil +} + +type historyZones2Where[Q psql.Filterable] struct { + OrganizationID psql.WhereNullMod[Q, int32] + Creationdate psql.WhereNullMod[Q, int64] + Creator psql.WhereNullMod[Q, string] + Editdate psql.WhereNullMod[Q, int64] + Editor psql.WhereNullMod[Q, string] + Globalid psql.WhereNullMod[Q, string] + Name psql.WhereNullMod[Q, string] + Objectid psql.WhereMod[Q, int32] + ShapeArea psql.WhereNullMod[Q, float64] + ShapeLength psql.WhereNullMod[Q, float64] + CreatedDate psql.WhereNullMod[Q, int64] + CreatedUser psql.WhereNullMod[Q, string] + GeometryX psql.WhereNullMod[Q, float64] + GeometryY psql.WhereNullMod[Q, float64] + LastEditedDate psql.WhereNullMod[Q, int64] + LastEditedUser psql.WhereNullMod[Q, string] + Version psql.WhereMod[Q, int32] +} + +func (historyZones2Where[Q]) AliasedAs(alias string) historyZones2Where[Q] { + return buildHistoryZones2Where[Q](buildHistoryZones2Columns(alias)) +} + +func buildHistoryZones2Where[Q psql.Filterable](cols historyZones2Columns) historyZones2Where[Q] { + return historyZones2Where[Q]{ + OrganizationID: psql.WhereNull[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), + Editor: psql.WhereNull[Q, string](cols.Editor), + Globalid: psql.WhereNull[Q, string](cols.Globalid), + Name: psql.WhereNull[Q, string](cols.Name), + Objectid: psql.Where[Q, int32](cols.Objectid), + ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), + ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), + CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), + GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), + GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), + LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), + Version: psql.Where[Q, int32](cols.Version), + } +} + +func (o *HistoryZones2) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("historyZones2 cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.HistoryZones2s = HistoryZones2Slice{o} + } + return nil + default: + return fmt.Errorf("historyZones2 has no relationship %q", name) + } +} + +type historyZones2Preloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildHistoryZones2Preloader() historyZones2Preloader { + return historyZones2Preloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: HistoryZones2s, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type historyZones2ThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildHistoryZones2ThenLoader[Q orm.Loadable]() historyZones2ThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return historyZones2ThenLoader[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 historyZones2's Organization into the .R struct +func (o *HistoryZones2) 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.HistoryZones2s = HistoryZones2Slice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the historyZones2's Organization into the .R struct +func (os HistoryZones2Slice) 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.IsValue() { + continue + } + + if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + continue + } + + rel.R.HistoryZones2s = append(rel.R.HistoryZones2s, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type historyZones2Joins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j historyZones2Joins[Q]) aliasedAs(alias string) historyZones2Joins[Q] { + return buildHistoryZones2Joins[Q](buildHistoryZones2Columns(alias), j.typ) +} + +func buildHistoryZones2Joins[Q dialect.Joinable](cols historyZones2Columns, typ string) historyZones2Joins[Q] { + return historyZones2Joins[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/organization.bob.go b/models/organization.bob.go index 7f870959..78b6e26b 100644 --- a/models/organization.bob.go +++ b/models/organization.bob.go @@ -25,10 +25,11 @@ import ( // Organization is an object representing the database table. type Organization struct { - ID int32 `db:"id,pk" ` - Name null.Val[string] `db:"name" ` - ArcgisID null.Val[string] `db:"arcgis_id" ` - ArcgisName null.Val[string] `db:"arcgis_name" ` + ID int32 `db:"id,pk" ` + Name null.Val[string] `db:"name" ` + ArcgisID null.Val[string] `db:"arcgis_id" ` + ArcgisName null.Val[string] `db:"arcgis_name" ` + FieldseekerURL null.Val[string] `db:"fieldseeker_url" ` R organizationR `db:"-" ` } @@ -45,29 +46,85 @@ type OrganizationsQuery = *psql.ViewQuery[*Organization, OrganizationSlice] // organizationR is where relationships are stored. type organizationR struct { - User UserSlice // user_.user__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 + FSInspectionsamples FSInspectionsampleSlice // fs_inspectionsample.fs_inspectionsample_organization_id_fkey + FSInspectionsampledetails FSInspectionsampledetailSlice // fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey + FSLinelocations FSLinelocationSlice // fs_linelocation.fs_linelocation_organization_id_fkey + FSLocationtrackings FSLocationtrackingSlice // fs_locationtracking.fs_locationtracking_organization_id_fkey + FSMosquitoinspections FSMosquitoinspectionSlice // fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey + FSPointlocations FSPointlocationSlice // fs_pointlocation.fs_pointlocation_organization_id_fkey + FSPolygonlocations FSPolygonlocationSlice // fs_polygonlocation.fs_polygonlocation_organization_id_fkey + FSPools FSPoolSlice // fs_pool.fs_pool_organization_id_fkey + FSPooldetails FSPooldetailSlice // fs_pooldetail.fs_pooldetail_organization_id_fkey + FSProposedtreatmentareas FSProposedtreatmentareaSlice // fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey + FSQamosquitoinspections FSQamosquitoinspectionSlice // fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey + FSRodentlocations FSRodentlocationSlice // fs_rodentlocation.fs_rodentlocation_organization_id_fkey + FSSamplecollections FSSamplecollectionSlice // fs_samplecollection.fs_samplecollection_organization_id_fkey + FSSamplelocations FSSamplelocationSlice // fs_samplelocation.fs_samplelocation_organization_id_fkey + FSServicerequests FSServicerequestSlice // fs_servicerequest.fs_servicerequest_organization_id_fkey + FSSpeciesabundances FSSpeciesabundanceSlice // fs_speciesabundance.fs_speciesabundance_organization_id_fkey + FSStormdrains FSStormdrainSlice // fs_stormdrain.fs_stormdrain_organization_id_fkey + FSTimecards FSTimecardSlice // fs_timecard.fs_timecard_organization_id_fkey + FSTrapdata FSTrapdatumSlice // fs_trapdata.fs_trapdata_organization_id_fkey + FSTraplocations FSTraplocationSlice // fs_traplocation.fs_traplocation_organization_id_fkey + FSTreatments FSTreatmentSlice // fs_treatment.fs_treatment_organization_id_fkey + FSTreatmentareas FSTreatmentareaSlice // fs_treatmentarea.fs_treatmentarea_organization_id_fkey + FSZones FSZoneSlice // fs_zones.fs_zones_organization_id_fkey + FSZones2s FSZones2Slice // fs_zones2.fs_zones2_organization_id_fkey + HistoryContainerrelates HistoryContainerrelateSlice // history_containerrelate.history_containerrelate_organization_id_fkey + HistoryFieldscoutinglogs HistoryFieldscoutinglogSlice // history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey + HistoryHabitatrelates HistoryHabitatrelateSlice // history_habitatrelate.history_habitatrelate_organization_id_fkey + HistoryInspectionsamples HistoryInspectionsampleSlice // history_inspectionsample.history_inspectionsample_organization_id_fkey + HistoryInspectionsampledetails HistoryInspectionsampledetailSlice // history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey + HistoryLinelocations HistoryLinelocationSlice // history_linelocation.history_linelocation_organization_id_fkey + HistoryLocationtrackings HistoryLocationtrackingSlice // history_locationtracking.history_locationtracking_organization_id_fkey + HistoryMosquitoinspections HistoryMosquitoinspectionSlice // history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey + HistoryPointlocations HistoryPointlocationSlice // history_pointlocation.history_pointlocation_organization_id_fkey + HistoryPolygonlocations HistoryPolygonlocationSlice // history_polygonlocation.history_polygonlocation_organization_id_fkey + HistoryPools HistoryPoolSlice // history_pool.history_pool_organization_id_fkey + HistoryPooldetails HistoryPooldetailSlice // history_pooldetail.history_pooldetail_organization_id_fkey + HistoryProposedtreatmentareas HistoryProposedtreatmentareaSlice // history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey + HistoryQamosquitoinspections HistoryQamosquitoinspectionSlice // history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey + HistoryRodentlocations HistoryRodentlocationSlice // history_rodentlocation.history_rodentlocation_organization_id_fkey + HistorySamplecollections HistorySamplecollectionSlice // history_samplecollection.history_samplecollection_organization_id_fkey + HistorySamplelocations HistorySamplelocationSlice // history_samplelocation.history_samplelocation_organization_id_fkey + HistoryServicerequests HistoryServicerequestSlice // history_servicerequest.history_servicerequest_organization_id_fkey + HistorySpeciesabundances HistorySpeciesabundanceSlice // history_speciesabundance.history_speciesabundance_organization_id_fkey + HistoryStormdrains HistoryStormdrainSlice // history_stormdrain.history_stormdrain_organization_id_fkey + HistoryTimecards HistoryTimecardSlice // history_timecard.history_timecard_organization_id_fkey + HistoryTrapdata HistoryTrapdatumSlice // history_trapdata.history_trapdata_organization_id_fkey + HistoryTraplocations HistoryTraplocationSlice // history_traplocation.history_traplocation_organization_id_fkey + HistoryTreatments HistoryTreatmentSlice // history_treatment.history_treatment_organization_id_fkey + HistoryTreatmentareas HistoryTreatmentareaSlice // history_treatmentarea.history_treatmentarea_organization_id_fkey + HistoryZones HistoryZoneSlice // history_zones.history_zones_organization_id_fkey + HistoryZones2s HistoryZones2Slice // history_zones2.history_zones2_organization_id_fkey + User UserSlice // user_.user__organization_id_fkey } func buildOrganizationColumns(alias string) organizationColumns { return organizationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "id", "name", "arcgis_id", "arcgis_name", + "id", "name", "arcgis_id", "arcgis_name", "fieldseeker_url", ).WithParent("organization"), - tableAlias: alias, - ID: psql.Quote(alias, "id"), - Name: psql.Quote(alias, "name"), - ArcgisID: psql.Quote(alias, "arcgis_id"), - ArcgisName: psql.Quote(alias, "arcgis_name"), + tableAlias: alias, + ID: psql.Quote(alias, "id"), + Name: psql.Quote(alias, "name"), + ArcgisID: psql.Quote(alias, "arcgis_id"), + ArcgisName: psql.Quote(alias, "arcgis_name"), + FieldseekerURL: psql.Quote(alias, "fieldseeker_url"), } } type organizationColumns struct { expr.ColumnsExpr - tableAlias string - ID psql.Expression - Name psql.Expression - ArcgisID psql.Expression - ArcgisName psql.Expression + tableAlias string + ID psql.Expression + Name psql.Expression + ArcgisID psql.Expression + ArcgisName psql.Expression + FieldseekerURL psql.Expression } func (c organizationColumns) Alias() string { @@ -82,14 +139,15 @@ func (organizationColumns) AliasedAs(alias string) organizationColumns { // All values are optional, and do not have to be set // Generated columns are not included type OrganizationSetter struct { - ID omit.Val[int32] `db:"id,pk" ` - Name omitnull.Val[string] `db:"name" ` - ArcgisID omitnull.Val[string] `db:"arcgis_id" ` - ArcgisName omitnull.Val[string] `db:"arcgis_name" ` + ID omit.Val[int32] `db:"id,pk" ` + Name omitnull.Val[string] `db:"name" ` + ArcgisID omitnull.Val[string] `db:"arcgis_id" ` + ArcgisName omitnull.Val[string] `db:"arcgis_name" ` + FieldseekerURL omitnull.Val[string] `db:"fieldseeker_url" ` } func (s OrganizationSetter) SetColumns() []string { - vals := make([]string, 0, 4) + vals := make([]string, 0, 5) if s.ID.IsValue() { vals = append(vals, "id") } @@ -102,6 +160,9 @@ func (s OrganizationSetter) SetColumns() []string { if !s.ArcgisName.IsUnset() { vals = append(vals, "arcgis_name") } + if !s.FieldseekerURL.IsUnset() { + vals = append(vals, "fieldseeker_url") + } return vals } @@ -118,6 +179,9 @@ func (s OrganizationSetter) Overwrite(t *Organization) { if !s.ArcgisName.IsUnset() { t.ArcgisName = s.ArcgisName.MustGetNull() } + if !s.FieldseekerURL.IsUnset() { + t.FieldseekerURL = s.FieldseekerURL.MustGetNull() + } } func (s *OrganizationSetter) Apply(q *dialect.InsertQuery) { @@ -126,7 +190,7 @@ func (s *OrganizationSetter) 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, 4) + vals := make([]bob.Expression, 5) if s.ID.IsValue() { vals[0] = psql.Arg(s.ID.MustGet()) } else { @@ -151,6 +215,12 @@ func (s *OrganizationSetter) Apply(q *dialect.InsertQuery) { vals[3] = psql.Raw("DEFAULT") } + if !s.FieldseekerURL.IsUnset() { + vals[4] = psql.Arg(s.FieldseekerURL.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -160,7 +230,7 @@ func (s OrganizationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s OrganizationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 4) + exprs := make([]bob.Expression, 0, 5) if s.ID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -190,6 +260,13 @@ func (s OrganizationSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.FieldseekerURL.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "fieldseeker_url")...), + psql.Arg(s.FieldseekerURL), + }}) + } + return exprs } @@ -416,6 +493,1302 @@ func (o OrganizationSlice) ReloadAll(ctx context.Context, exec bob.Executor) err return nil } +// 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, + sm.Where(FSContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSContainerrelatesQuery { + 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 FSContainerrelates.Query(append(mods, + sm.Where(psql.Group(FSContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSFieldscoutinglogs starts a query for related objects on fs_fieldscoutinglog +func (o *Organization) FSFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FSFieldscoutinglogsQuery { + return FSFieldscoutinglogs.Query(append(mods, + sm.Where(FSFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FSFieldscoutinglogsQuery { + 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 FSFieldscoutinglogs.Query(append(mods, + sm.Where(psql.Group(FSFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSHabitatrelates starts a query for related objects on fs_habitatrelate +func (o *Organization) FSHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSHabitatrelatesQuery { + return FSHabitatrelates.Query(append(mods, + sm.Where(FSHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSHabitatrelatesQuery { + 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 FSHabitatrelates.Query(append(mods, + sm.Where(psql.Group(FSHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSInspectionsamples starts a query for related objects on fs_inspectionsample +func (o *Organization) FSInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsamplesQuery { + return FSInspectionsamples.Query(append(mods, + sm.Where(FSInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsamplesQuery { + 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 FSInspectionsamples.Query(append(mods, + sm.Where(psql.Group(FSInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSInspectionsampledetails starts a query for related objects on fs_inspectionsampledetail +func (o *Organization) FSInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsampledetailsQuery { + return FSInspectionsampledetails.Query(append(mods, + sm.Where(FSInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsampledetailsQuery { + 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 FSInspectionsampledetails.Query(append(mods, + sm.Where(psql.Group(FSInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSLinelocations starts a query for related objects on fs_linelocation +func (o *Organization) FSLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSLinelocationsQuery { + return FSLinelocations.Query(append(mods, + sm.Where(FSLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSLinelocationsQuery { + 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 FSLinelocations.Query(append(mods, + sm.Where(psql.Group(FSLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSLocationtrackings starts a query for related objects on fs_locationtracking +func (o *Organization) FSLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FSLocationtrackingsQuery { + return FSLocationtrackings.Query(append(mods, + sm.Where(FSLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FSLocationtrackingsQuery { + 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 FSLocationtrackings.Query(append(mods, + sm.Where(psql.Group(FSLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSMosquitoinspections starts a query for related objects on fs_mosquitoinspection +func (o *Organization) FSMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSMosquitoinspectionsQuery { + return FSMosquitoinspections.Query(append(mods, + sm.Where(FSMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSMosquitoinspectionsQuery { + 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 FSMosquitoinspections.Query(append(mods, + sm.Where(psql.Group(FSMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSPointlocations starts a query for related objects on fs_pointlocation +func (o *Organization) FSPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPointlocationsQuery { + return FSPointlocations.Query(append(mods, + sm.Where(FSPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPointlocationsQuery { + 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 FSPointlocations.Query(append(mods, + sm.Where(psql.Group(FSPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSPolygonlocations starts a query for related objects on fs_polygonlocation +func (o *Organization) FSPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPolygonlocationsQuery { + return FSPolygonlocations.Query(append(mods, + sm.Where(FSPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPolygonlocationsQuery { + 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 FSPolygonlocations.Query(append(mods, + sm.Where(psql.Group(FSPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSPools starts a query for related objects on fs_pool +func (o *Organization) FSPools(mods ...bob.Mod[*dialect.SelectQuery]) FSPoolsQuery { + return FSPools.Query(append(mods, + sm.Where(FSPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSPools(mods ...bob.Mod[*dialect.SelectQuery]) FSPoolsQuery { + 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 FSPools.Query(append(mods, + sm.Where(psql.Group(FSPools.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSPooldetails starts a query for related objects on fs_pooldetail +func (o *Organization) FSPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FSPooldetailsQuery { + return FSPooldetails.Query(append(mods, + sm.Where(FSPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FSPooldetailsQuery { + 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 FSPooldetails.Query(append(mods, + sm.Where(psql.Group(FSPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSProposedtreatmentareas starts a query for related objects on fs_proposedtreatmentarea +func (o *Organization) FSProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSProposedtreatmentareasQuery { + return FSProposedtreatmentareas.Query(append(mods, + sm.Where(FSProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSProposedtreatmentareasQuery { + 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 FSProposedtreatmentareas.Query(append(mods, + sm.Where(psql.Group(FSProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSQamosquitoinspections starts a query for related objects on fs_qamosquitoinspection +func (o *Organization) FSQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSQamosquitoinspectionsQuery { + return FSQamosquitoinspections.Query(append(mods, + sm.Where(FSQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSQamosquitoinspectionsQuery { + 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 FSQamosquitoinspections.Query(append(mods, + sm.Where(psql.Group(FSQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSRodentlocations starts a query for related objects on fs_rodentlocation +func (o *Organization) FSRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSRodentlocationsQuery { + return FSRodentlocations.Query(append(mods, + sm.Where(FSRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSRodentlocationsQuery { + 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 FSRodentlocations.Query(append(mods, + sm.Where(psql.Group(FSRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSSamplecollections starts a query for related objects on fs_samplecollection +func (o *Organization) FSSamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplecollectionsQuery { + return FSSamplecollections.Query(append(mods, + sm.Where(FSSamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSSamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplecollectionsQuery { + 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 FSSamplecollections.Query(append(mods, + sm.Where(psql.Group(FSSamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSSamplelocations starts a query for related objects on fs_samplelocation +func (o *Organization) FSSamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplelocationsQuery { + return FSSamplelocations.Query(append(mods, + sm.Where(FSSamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSSamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplelocationsQuery { + 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 FSSamplelocations.Query(append(mods, + sm.Where(psql.Group(FSSamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSServicerequests starts a query for related objects on fs_servicerequest +func (o *Organization) FSServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FSServicerequestsQuery { + return FSServicerequests.Query(append(mods, + sm.Where(FSServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FSServicerequestsQuery { + 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 FSServicerequests.Query(append(mods, + sm.Where(psql.Group(FSServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSSpeciesabundances starts a query for related objects on fs_speciesabundance +func (o *Organization) FSSpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FSSpeciesabundancesQuery { + return FSSpeciesabundances.Query(append(mods, + sm.Where(FSSpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSSpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FSSpeciesabundancesQuery { + 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 FSSpeciesabundances.Query(append(mods, + sm.Where(psql.Group(FSSpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSStormdrains starts a query for related objects on fs_stormdrain +func (o *Organization) FSStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FSStormdrainsQuery { + return FSStormdrains.Query(append(mods, + sm.Where(FSStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FSStormdrainsQuery { + 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 FSStormdrains.Query(append(mods, + sm.Where(psql.Group(FSStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSTimecards starts a query for related objects on fs_timecard +func (o *Organization) FSTimecards(mods ...bob.Mod[*dialect.SelectQuery]) FSTimecardsQuery { + return FSTimecards.Query(append(mods, + sm.Where(FSTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSTimecards(mods ...bob.Mod[*dialect.SelectQuery]) FSTimecardsQuery { + 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 FSTimecards.Query(append(mods, + sm.Where(psql.Group(FSTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSTrapdata starts a query for related objects on fs_trapdata +func (o *Organization) FSTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) FSTrapdataQuery { + return FSTrapdata.Query(append(mods, + sm.Where(FSTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) FSTrapdataQuery { + 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 FSTrapdata.Query(append(mods, + sm.Where(psql.Group(FSTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSTraplocations starts a query for related objects on fs_traplocation +func (o *Organization) FSTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) FSTraplocationsQuery { + return FSTraplocations.Query(append(mods, + sm.Where(FSTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) FSTraplocationsQuery { + 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 FSTraplocations.Query(append(mods, + sm.Where(psql.Group(FSTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSTreatments starts a query for related objects on fs_treatment +func (o *Organization) FSTreatments(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentsQuery { + return FSTreatments.Query(append(mods, + sm.Where(FSTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSTreatments(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentsQuery { + 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 FSTreatments.Query(append(mods, + sm.Where(psql.Group(FSTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSTreatmentareas starts a query for related objects on fs_treatmentarea +func (o *Organization) FSTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentareasQuery { + return FSTreatmentareas.Query(append(mods, + sm.Where(FSTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentareasQuery { + 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 FSTreatmentareas.Query(append(mods, + sm.Where(psql.Group(FSTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSZones starts a query for related objects on fs_zones +func (o *Organization) FSZones(mods ...bob.Mod[*dialect.SelectQuery]) FSZonesQuery { + return FSZones.Query(append(mods, + sm.Where(FSZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSZones(mods ...bob.Mod[*dialect.SelectQuery]) FSZonesQuery { + 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 FSZones.Query(append(mods, + sm.Where(psql.Group(FSZones.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// FSZones2s starts a query for related objects on fs_zones2 +func (o *Organization) FSZones2s(mods ...bob.Mod[*dialect.SelectQuery]) FSZones2sQuery { + return FSZones2s.Query(append(mods, + sm.Where(FSZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FSZones2s(mods ...bob.Mod[*dialect.SelectQuery]) FSZones2sQuery { + 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 FSZones2s.Query(append(mods, + sm.Where(psql.Group(FSZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryContainerrelates starts a query for related objects on history_containerrelate +func (o *Organization) HistoryContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryContainerrelatesQuery { + return HistoryContainerrelates.Query(append(mods, + sm.Where(HistoryContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryContainerrelatesQuery { + 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 HistoryContainerrelates.Query(append(mods, + sm.Where(psql.Group(HistoryContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryFieldscoutinglogs starts a query for related objects on history_fieldscoutinglog +func (o *Organization) HistoryFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) HistoryFieldscoutinglogsQuery { + return HistoryFieldscoutinglogs.Query(append(mods, + sm.Where(HistoryFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) HistoryFieldscoutinglogsQuery { + 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 HistoryFieldscoutinglogs.Query(append(mods, + sm.Where(psql.Group(HistoryFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryHabitatrelates starts a query for related objects on history_habitatrelate +func (o *Organization) HistoryHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryHabitatrelatesQuery { + return HistoryHabitatrelates.Query(append(mods, + sm.Where(HistoryHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryHabitatrelatesQuery { + 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 HistoryHabitatrelates.Query(append(mods, + sm.Where(psql.Group(HistoryHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryInspectionsamples starts a query for related objects on history_inspectionsample +func (o *Organization) HistoryInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsamplesQuery { + return HistoryInspectionsamples.Query(append(mods, + sm.Where(HistoryInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsamplesQuery { + 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 HistoryInspectionsamples.Query(append(mods, + sm.Where(psql.Group(HistoryInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryInspectionsampledetails starts a query for related objects on history_inspectionsampledetail +func (o *Organization) HistoryInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsampledetailsQuery { + return HistoryInspectionsampledetails.Query(append(mods, + sm.Where(HistoryInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsampledetailsQuery { + 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 HistoryInspectionsampledetails.Query(append(mods, + sm.Where(psql.Group(HistoryInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryLinelocations starts a query for related objects on history_linelocation +func (o *Organization) HistoryLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLinelocationsQuery { + return HistoryLinelocations.Query(append(mods, + sm.Where(HistoryLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLinelocationsQuery { + 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 HistoryLinelocations.Query(append(mods, + sm.Where(psql.Group(HistoryLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryLocationtrackings starts a query for related objects on history_locationtracking +func (o *Organization) HistoryLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLocationtrackingsQuery { + return HistoryLocationtrackings.Query(append(mods, + sm.Where(HistoryLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLocationtrackingsQuery { + 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 HistoryLocationtrackings.Query(append(mods, + sm.Where(psql.Group(HistoryLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryMosquitoinspections starts a query for related objects on history_mosquitoinspection +func (o *Organization) HistoryMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryMosquitoinspectionsQuery { + return HistoryMosquitoinspections.Query(append(mods, + sm.Where(HistoryMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryMosquitoinspectionsQuery { + 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 HistoryMosquitoinspections.Query(append(mods, + sm.Where(psql.Group(HistoryMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryPointlocations starts a query for related objects on history_pointlocation +func (o *Organization) HistoryPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPointlocationsQuery { + return HistoryPointlocations.Query(append(mods, + sm.Where(HistoryPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPointlocationsQuery { + 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 HistoryPointlocations.Query(append(mods, + sm.Where(psql.Group(HistoryPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryPolygonlocations starts a query for related objects on history_polygonlocation +func (o *Organization) HistoryPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPolygonlocationsQuery { + return HistoryPolygonlocations.Query(append(mods, + sm.Where(HistoryPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPolygonlocationsQuery { + 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 HistoryPolygonlocations.Query(append(mods, + sm.Where(psql.Group(HistoryPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryPools starts a query for related objects on history_pool +func (o *Organization) HistoryPools(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPoolsQuery { + return HistoryPools.Query(append(mods, + sm.Where(HistoryPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryPools(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPoolsQuery { + 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 HistoryPools.Query(append(mods, + sm.Where(psql.Group(HistoryPools.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryPooldetails starts a query for related objects on history_pooldetail +func (o *Organization) HistoryPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPooldetailsQuery { + return HistoryPooldetails.Query(append(mods, + sm.Where(HistoryPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPooldetailsQuery { + 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 HistoryPooldetails.Query(append(mods, + sm.Where(psql.Group(HistoryPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryProposedtreatmentareas starts a query for related objects on history_proposedtreatmentarea +func (o *Organization) HistoryProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryProposedtreatmentareasQuery { + return HistoryProposedtreatmentareas.Query(append(mods, + sm.Where(HistoryProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryProposedtreatmentareasQuery { + 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 HistoryProposedtreatmentareas.Query(append(mods, + sm.Where(psql.Group(HistoryProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryQamosquitoinspections starts a query for related objects on history_qamosquitoinspection +func (o *Organization) HistoryQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryQamosquitoinspectionsQuery { + return HistoryQamosquitoinspections.Query(append(mods, + sm.Where(HistoryQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryQamosquitoinspectionsQuery { + 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 HistoryQamosquitoinspections.Query(append(mods, + sm.Where(psql.Group(HistoryQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryRodentlocations starts a query for related objects on history_rodentlocation +func (o *Organization) HistoryRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryRodentlocationsQuery { + return HistoryRodentlocations.Query(append(mods, + sm.Where(HistoryRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryRodentlocationsQuery { + 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 HistoryRodentlocations.Query(append(mods, + sm.Where(psql.Group(HistoryRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistorySamplecollections starts a query for related objects on history_samplecollection +func (o *Organization) HistorySamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplecollectionsQuery { + return HistorySamplecollections.Query(append(mods, + sm.Where(HistorySamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistorySamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplecollectionsQuery { + 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 HistorySamplecollections.Query(append(mods, + sm.Where(psql.Group(HistorySamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistorySamplelocations starts a query for related objects on history_samplelocation +func (o *Organization) HistorySamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplelocationsQuery { + return HistorySamplelocations.Query(append(mods, + sm.Where(HistorySamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistorySamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplelocationsQuery { + 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 HistorySamplelocations.Query(append(mods, + sm.Where(psql.Group(HistorySamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryServicerequests starts a query for related objects on history_servicerequest +func (o *Organization) HistoryServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) HistoryServicerequestsQuery { + return HistoryServicerequests.Query(append(mods, + sm.Where(HistoryServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) HistoryServicerequestsQuery { + 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 HistoryServicerequests.Query(append(mods, + sm.Where(psql.Group(HistoryServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistorySpeciesabundances starts a query for related objects on history_speciesabundance +func (o *Organization) HistorySpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) HistorySpeciesabundancesQuery { + return HistorySpeciesabundances.Query(append(mods, + sm.Where(HistorySpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistorySpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) HistorySpeciesabundancesQuery { + 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 HistorySpeciesabundances.Query(append(mods, + sm.Where(psql.Group(HistorySpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryStormdrains starts a query for related objects on history_stormdrain +func (o *Organization) HistoryStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) HistoryStormdrainsQuery { + return HistoryStormdrains.Query(append(mods, + sm.Where(HistoryStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) HistoryStormdrainsQuery { + 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 HistoryStormdrains.Query(append(mods, + sm.Where(psql.Group(HistoryStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryTimecards starts a query for related objects on history_timecard +func (o *Organization) HistoryTimecards(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTimecardsQuery { + return HistoryTimecards.Query(append(mods, + sm.Where(HistoryTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryTimecards(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTimecardsQuery { + 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 HistoryTimecards.Query(append(mods, + sm.Where(psql.Group(HistoryTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryTrapdata starts a query for related objects on history_trapdata +func (o *Organization) HistoryTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTrapdataQuery { + return HistoryTrapdata.Query(append(mods, + sm.Where(HistoryTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTrapdataQuery { + 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 HistoryTrapdata.Query(append(mods, + sm.Where(psql.Group(HistoryTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryTraplocations starts a query for related objects on history_traplocation +func (o *Organization) HistoryTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTraplocationsQuery { + return HistoryTraplocations.Query(append(mods, + sm.Where(HistoryTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTraplocationsQuery { + 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 HistoryTraplocations.Query(append(mods, + sm.Where(psql.Group(HistoryTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryTreatments starts a query for related objects on history_treatment +func (o *Organization) HistoryTreatments(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentsQuery { + return HistoryTreatments.Query(append(mods, + sm.Where(HistoryTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryTreatments(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentsQuery { + 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 HistoryTreatments.Query(append(mods, + sm.Where(psql.Group(HistoryTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryTreatmentareas starts a query for related objects on history_treatmentarea +func (o *Organization) HistoryTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentareasQuery { + return HistoryTreatmentareas.Query(append(mods, + sm.Where(HistoryTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentareasQuery { + 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 HistoryTreatmentareas.Query(append(mods, + sm.Where(psql.Group(HistoryTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryZones starts a query for related objects on history_zones +func (o *Organization) HistoryZones(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZonesQuery { + return HistoryZones.Query(append(mods, + sm.Where(HistoryZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryZones(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZonesQuery { + 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 HistoryZones.Query(append(mods, + sm.Where(psql.Group(HistoryZones.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// HistoryZones2s starts a query for related objects on history_zones2 +func (o *Organization) HistoryZones2s(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZones2sQuery { + return HistoryZones2s.Query(append(mods, + sm.Where(HistoryZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) HistoryZones2s(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZones2sQuery { + 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 HistoryZones2s.Query(append(mods, + sm.Where(psql.Group(HistoryZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // User starts a query for related objects on user_ func (o *Organization) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { return Users.Query(append(mods, @@ -440,6 +1813,3678 @@ func (os OrganizationSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQue )...) } +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) + } + + ret, err := FSContainerrelates.Insert(bob.ToMods(fsContainerrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSContainerrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executor, count int, fsContainerrelates1 FSContainerrelateSlice, organization0 *Organization) (FSContainerrelateSlice, error) { + setter := &FSContainerrelateSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsContainerrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSContainerrelates0: %w", err) + } + + return fsContainerrelates1, nil +} + +func (organization0 *Organization) InsertFSContainerrelates(ctx context.Context, exec bob.Executor, related ...*FSContainerrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsContainerrelates1, err := insertOrganizationFSContainerrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSContainerrelates = append(organization0.R.FSContainerrelates, fsContainerrelates1...) + + for _, rel := range fsContainerrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSContainerrelates(ctx context.Context, exec bob.Executor, related ...*FSContainerrelate) error { + if len(related) == 0 { + return nil + } + + var err error + fsContainerrelates1 := FSContainerrelateSlice(related) + + _, err = attachOrganizationFSContainerrelates0(ctx, exec, len(related), fsContainerrelates1, organization0) + if err != nil { + return err + } + + organization0.R.FSContainerrelates = append(organization0.R.FSContainerrelates, fsContainerrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSFieldscoutinglogs.Insert(bob.ToMods(fsFieldscoutinglogs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSFieldscoutinglogs0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglogs1 FSFieldscoutinglogSlice, organization0 *Organization) (FSFieldscoutinglogSlice, error) { + setter := &FSFieldscoutinglogSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSFieldscoutinglogs0: %w", err) + } + + return fsFieldscoutinglogs1, nil +} + +func (organization0 *Organization) InsertFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FSFieldscoutinglogSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsFieldscoutinglogs1, err := insertOrganizationFSFieldscoutinglogs0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSFieldscoutinglogs = append(organization0.R.FSFieldscoutinglogs, fsFieldscoutinglogs1...) + + for _, rel := range fsFieldscoutinglogs1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FSFieldscoutinglog) error { + if len(related) == 0 { + return nil + } + + var err error + fsFieldscoutinglogs1 := FSFieldscoutinglogSlice(related) + + _, err = attachOrganizationFSFieldscoutinglogs0(ctx, exec, len(related), fsFieldscoutinglogs1, organization0) + if err != nil { + return err + } + + organization0.R.FSFieldscoutinglogs = append(organization0.R.FSFieldscoutinglogs, fsFieldscoutinglogs1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSHabitatrelates.Insert(bob.ToMods(fsHabitatrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSHabitatrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelates1 FSHabitatrelateSlice, organization0 *Organization) (FSHabitatrelateSlice, error) { + setter := &FSHabitatrelateSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsHabitatrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSHabitatrelates0: %w", err) + } + + return fsHabitatrelates1, nil +} + +func (organization0 *Organization) InsertFSHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FSHabitatrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsHabitatrelates1, err := insertOrganizationFSHabitatrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSHabitatrelates = append(organization0.R.FSHabitatrelates, fsHabitatrelates1...) + + for _, rel := range fsHabitatrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FSHabitatrelate) error { + if len(related) == 0 { + return nil + } + + var err error + fsHabitatrelates1 := FSHabitatrelateSlice(related) + + _, err = attachOrganizationFSHabitatrelates0(ctx, exec, len(related), fsHabitatrelates1, organization0) + if err != nil { + return err + } + + organization0.R.FSHabitatrelates = append(organization0.R.FSHabitatrelates, fsHabitatrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSInspectionsamples.Insert(bob.ToMods(fsInspectionsamples1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSInspectionsamples0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Executor, count int, fsInspectionsamples1 FSInspectionsampleSlice, organization0 *Organization) (FSInspectionsampleSlice, error) { + setter := &FSInspectionsampleSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsInspectionsamples1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSInspectionsamples0: %w", err) + } + + return fsInspectionsamples1, nil +} + +func (organization0 *Organization) InsertFSInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampleSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsInspectionsamples1, err := insertOrganizationFSInspectionsamples0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSInspectionsamples = append(organization0.R.FSInspectionsamples, fsInspectionsamples1...) + + for _, rel := range fsInspectionsamples1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FSInspectionsample) error { + if len(related) == 0 { + return nil + } + + var err error + fsInspectionsamples1 := FSInspectionsampleSlice(related) + + _, err = attachOrganizationFSInspectionsamples0(ctx, exec, len(related), fsInspectionsamples1, organization0) + if err != nil { + return err + } + + organization0.R.FSInspectionsamples = append(organization0.R.FSInspectionsamples, fsInspectionsamples1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSInspectionsampledetails.Insert(bob.ToMods(fsInspectionsampledetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSInspectionsampledetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetails1 FSInspectionsampledetailSlice, organization0 *Organization) (FSInspectionsampledetailSlice, error) { + setter := &FSInspectionsampledetailSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsInspectionsampledetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSInspectionsampledetails0: %w", err) + } + + return fsInspectionsampledetails1, nil +} + +func (organization0 *Organization) InsertFSInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampledetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsInspectionsampledetails1, err := insertOrganizationFSInspectionsampledetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSInspectionsampledetails = append(organization0.R.FSInspectionsampledetails, fsInspectionsampledetails1...) + + for _, rel := range fsInspectionsampledetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampledetail) error { + if len(related) == 0 { + return nil + } + + var err error + fsInspectionsampledetails1 := FSInspectionsampledetailSlice(related) + + _, err = attachOrganizationFSInspectionsampledetails0(ctx, exec, len(related), fsInspectionsampledetails1, organization0) + if err != nil { + return err + } + + organization0.R.FSInspectionsampledetails = append(organization0.R.FSInspectionsampledetails, fsInspectionsampledetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSLinelocations.Insert(bob.ToMods(fsLinelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSLinelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, count int, fsLinelocations1 FSLinelocationSlice, organization0 *Organization) (FSLinelocationSlice, error) { + setter := &FSLinelocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsLinelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSLinelocations0: %w", err) + } + + return fsLinelocations1, nil +} + +func (organization0 *Organization) InsertFSLinelocations(ctx context.Context, exec bob.Executor, related ...*FSLinelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsLinelocations1, err := insertOrganizationFSLinelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSLinelocations = append(organization0.R.FSLinelocations, fsLinelocations1...) + + for _, rel := range fsLinelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSLinelocations(ctx context.Context, exec bob.Executor, related ...*FSLinelocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsLinelocations1 := FSLinelocationSlice(related) + + _, err = attachOrganizationFSLinelocations0(ctx, exec, len(related), fsLinelocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSLinelocations = append(organization0.R.FSLinelocations, fsLinelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSLocationtrackings.Insert(bob.ToMods(fsLocationtrackings1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSLocationtrackings0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Executor, count int, fsLocationtrackings1 FSLocationtrackingSlice, organization0 *Organization) (FSLocationtrackingSlice, error) { + setter := &FSLocationtrackingSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsLocationtrackings1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSLocationtrackings0: %w", err) + } + + return fsLocationtrackings1, nil +} + +func (organization0 *Organization) InsertFSLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FSLocationtrackingSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsLocationtrackings1, err := insertOrganizationFSLocationtrackings0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSLocationtrackings = append(organization0.R.FSLocationtrackings, fsLocationtrackings1...) + + for _, rel := range fsLocationtrackings1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FSLocationtracking) error { + if len(related) == 0 { + return nil + } + + var err error + fsLocationtrackings1 := FSLocationtrackingSlice(related) + + _, err = attachOrganizationFSLocationtrackings0(ctx, exec, len(related), fsLocationtrackings1, organization0) + if err != nil { + return err + } + + organization0.R.FSLocationtrackings = append(organization0.R.FSLocationtrackings, fsLocationtrackings1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSMosquitoinspections.Insert(bob.ToMods(fsMosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSMosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspections1 FSMosquitoinspectionSlice, organization0 *Organization) (FSMosquitoinspectionSlice, error) { + setter := &FSMosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsMosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSMosquitoinspections0: %w", err) + } + + return fsMosquitoinspections1, nil +} + +func (organization0 *Organization) InsertFSMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSMosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsMosquitoinspections1, err := insertOrganizationFSMosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSMosquitoinspections = append(organization0.R.FSMosquitoinspections, fsMosquitoinspections1...) + + for _, rel := range fsMosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSMosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + fsMosquitoinspections1 := FSMosquitoinspectionSlice(related) + + _, err = attachOrganizationFSMosquitoinspections0(ctx, exec, len(related), fsMosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.FSMosquitoinspections = append(organization0.R.FSMosquitoinspections, fsMosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSPointlocations.Insert(bob.ToMods(fsPointlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSPointlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, count int, fsPointlocations1 FSPointlocationSlice, organization0 *Organization) (FSPointlocationSlice, error) { + setter := &FSPointlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsPointlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSPointlocations0: %w", err) + } + + return fsPointlocations1, nil +} + +func (organization0 *Organization) InsertFSPointlocations(ctx context.Context, exec bob.Executor, related ...*FSPointlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsPointlocations1, err := insertOrganizationFSPointlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSPointlocations = append(organization0.R.FSPointlocations, fsPointlocations1...) + + for _, rel := range fsPointlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSPointlocations(ctx context.Context, exec bob.Executor, related ...*FSPointlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsPointlocations1 := FSPointlocationSlice(related) + + _, err = attachOrganizationFSPointlocations0(ctx, exec, len(related), fsPointlocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSPointlocations = append(organization0.R.FSPointlocations, fsPointlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSPolygonlocations.Insert(bob.ToMods(fsPolygonlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSPolygonlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocations1 FSPolygonlocationSlice, organization0 *Organization) (FSPolygonlocationSlice, error) { + setter := &FSPolygonlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsPolygonlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSPolygonlocations0: %w", err) + } + + return fsPolygonlocations1, nil +} + +func (organization0 *Organization) InsertFSPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FSPolygonlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsPolygonlocations1, err := insertOrganizationFSPolygonlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSPolygonlocations = append(organization0.R.FSPolygonlocations, fsPolygonlocations1...) + + for _, rel := range fsPolygonlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FSPolygonlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsPolygonlocations1 := FSPolygonlocationSlice(related) + + _, err = attachOrganizationFSPolygonlocations0(ctx, exec, len(related), fsPolygonlocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSPolygonlocations = append(organization0.R.FSPolygonlocations, fsPolygonlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSPools.Insert(bob.ToMods(fsPools1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSPools0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSPools0(ctx context.Context, exec bob.Executor, count int, fsPools1 FSPoolSlice, organization0 *Organization) (FSPoolSlice, error) { + setter := &FSPoolSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsPools1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSPools0: %w", err) + } + + return fsPools1, nil +} + +func (organization0 *Organization) InsertFSPools(ctx context.Context, exec bob.Executor, related ...*FSPoolSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsPools1, err := insertOrganizationFSPools0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSPools = append(organization0.R.FSPools, fsPools1...) + + for _, rel := range fsPools1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSPools(ctx context.Context, exec bob.Executor, related ...*FSPool) error { + if len(related) == 0 { + return nil + } + + var err error + fsPools1 := FSPoolSlice(related) + + _, err = attachOrganizationFSPools0(ctx, exec, len(related), fsPools1, organization0) + if err != nil { + return err + } + + organization0.R.FSPools = append(organization0.R.FSPools, fsPools1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSPooldetails.Insert(bob.ToMods(fsPooldetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSPooldetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, count int, fsPooldetails1 FSPooldetailSlice, organization0 *Organization) (FSPooldetailSlice, error) { + setter := &FSPooldetailSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsPooldetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSPooldetails0: %w", err) + } + + return fsPooldetails1, nil +} + +func (organization0 *Organization) InsertFSPooldetails(ctx context.Context, exec bob.Executor, related ...*FSPooldetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsPooldetails1, err := insertOrganizationFSPooldetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSPooldetails = append(organization0.R.FSPooldetails, fsPooldetails1...) + + for _, rel := range fsPooldetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSPooldetails(ctx context.Context, exec bob.Executor, related ...*FSPooldetail) error { + if len(related) == 0 { + return nil + } + + var err error + fsPooldetails1 := FSPooldetailSlice(related) + + _, err = attachOrganizationFSPooldetails0(ctx, exec, len(related), fsPooldetails1, organization0) + if err != nil { + return err + } + + organization0.R.FSPooldetails = append(organization0.R.FSPooldetails, fsPooldetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSProposedtreatmentareas.Insert(bob.ToMods(fsProposedtreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSProposedtreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentareas1 FSProposedtreatmentareaSlice, organization0 *Organization) (FSProposedtreatmentareaSlice, error) { + setter := &FSProposedtreatmentareaSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSProposedtreatmentareas0: %w", err) + } + + return fsProposedtreatmentareas1, nil +} + +func (organization0 *Organization) InsertFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSProposedtreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsProposedtreatmentareas1, err := insertOrganizationFSProposedtreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSProposedtreatmentareas = append(organization0.R.FSProposedtreatmentareas, fsProposedtreatmentareas1...) + + for _, rel := range fsProposedtreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSProposedtreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + fsProposedtreatmentareas1 := FSProposedtreatmentareaSlice(related) + + _, err = attachOrganizationFSProposedtreatmentareas0(ctx, exec, len(related), fsProposedtreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.FSProposedtreatmentareas = append(organization0.R.FSProposedtreatmentareas, fsProposedtreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSQamosquitoinspections.Insert(bob.ToMods(fsQamosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSQamosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspections1 FSQamosquitoinspectionSlice, organization0 *Organization) (FSQamosquitoinspectionSlice, error) { + setter := &FSQamosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsQamosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSQamosquitoinspections0: %w", err) + } + + return fsQamosquitoinspections1, nil +} + +func (organization0 *Organization) InsertFSQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSQamosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsQamosquitoinspections1, err := insertOrganizationFSQamosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSQamosquitoinspections = append(organization0.R.FSQamosquitoinspections, fsQamosquitoinspections1...) + + for _, rel := range fsQamosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSQamosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + fsQamosquitoinspections1 := FSQamosquitoinspectionSlice(related) + + _, err = attachOrganizationFSQamosquitoinspections0(ctx, exec, len(related), fsQamosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.FSQamosquitoinspections = append(organization0.R.FSQamosquitoinspections, fsQamosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSRodentlocations.Insert(bob.ToMods(fsRodentlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSRodentlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor, count int, fsRodentlocations1 FSRodentlocationSlice, organization0 *Organization) (FSRodentlocationSlice, error) { + setter := &FSRodentlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsRodentlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSRodentlocations0: %w", err) + } + + return fsRodentlocations1, nil +} + +func (organization0 *Organization) InsertFSRodentlocations(ctx context.Context, exec bob.Executor, related ...*FSRodentlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsRodentlocations1, err := insertOrganizationFSRodentlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSRodentlocations = append(organization0.R.FSRodentlocations, fsRodentlocations1...) + + for _, rel := range fsRodentlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSRodentlocations(ctx context.Context, exec bob.Executor, related ...*FSRodentlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsRodentlocations1 := FSRodentlocationSlice(related) + + _, err = attachOrganizationFSRodentlocations0(ctx, exec, len(related), fsRodentlocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSRodentlocations = append(organization0.R.FSRodentlocations, fsRodentlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSSamplecollections.Insert(bob.ToMods(fsSamplecollections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSSamplecollections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSSamplecollections0(ctx context.Context, exec bob.Executor, count int, fsSamplecollections1 FSSamplecollectionSlice, organization0 *Organization) (FSSamplecollectionSlice, error) { + setter := &FSSamplecollectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsSamplecollections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSSamplecollections0: %w", err) + } + + return fsSamplecollections1, nil +} + +func (organization0 *Organization) InsertFSSamplecollections(ctx context.Context, exec bob.Executor, related ...*FSSamplecollectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsSamplecollections1, err := insertOrganizationFSSamplecollections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSSamplecollections = append(organization0.R.FSSamplecollections, fsSamplecollections1...) + + for _, rel := range fsSamplecollections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSSamplecollections(ctx context.Context, exec bob.Executor, related ...*FSSamplecollection) error { + if len(related) == 0 { + return nil + } + + var err error + fsSamplecollections1 := FSSamplecollectionSlice(related) + + _, err = attachOrganizationFSSamplecollections0(ctx, exec, len(related), fsSamplecollections1, organization0) + if err != nil { + return err + } + + organization0.R.FSSamplecollections = append(organization0.R.FSSamplecollections, fsSamplecollections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSSamplelocations.Insert(bob.ToMods(fsSamplelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSSamplelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor, count int, fsSamplelocations1 FSSamplelocationSlice, organization0 *Organization) (FSSamplelocationSlice, error) { + setter := &FSSamplelocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsSamplelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSSamplelocations0: %w", err) + } + + return fsSamplelocations1, nil +} + +func (organization0 *Organization) InsertFSSamplelocations(ctx context.Context, exec bob.Executor, related ...*FSSamplelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsSamplelocations1, err := insertOrganizationFSSamplelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSSamplelocations = append(organization0.R.FSSamplelocations, fsSamplelocations1...) + + for _, rel := range fsSamplelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSSamplelocations(ctx context.Context, exec bob.Executor, related ...*FSSamplelocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsSamplelocations1 := FSSamplelocationSlice(related) + + _, err = attachOrganizationFSSamplelocations0(ctx, exec, len(related), fsSamplelocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSSamplelocations = append(organization0.R.FSSamplelocations, fsSamplelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSServicerequests.Insert(bob.ToMods(fsServicerequests1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSServicerequests0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor, count int, fsServicerequests1 FSServicerequestSlice, organization0 *Organization) (FSServicerequestSlice, error) { + setter := &FSServicerequestSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsServicerequests1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSServicerequests0: %w", err) + } + + return fsServicerequests1, nil +} + +func (organization0 *Organization) InsertFSServicerequests(ctx context.Context, exec bob.Executor, related ...*FSServicerequestSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsServicerequests1, err := insertOrganizationFSServicerequests0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSServicerequests = append(organization0.R.FSServicerequests, fsServicerequests1...) + + for _, rel := range fsServicerequests1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSServicerequests(ctx context.Context, exec bob.Executor, related ...*FSServicerequest) error { + if len(related) == 0 { + return nil + } + + var err error + fsServicerequests1 := FSServicerequestSlice(related) + + _, err = attachOrganizationFSServicerequests0(ctx, exec, len(related), fsServicerequests1, organization0) + if err != nil { + return err + } + + organization0.R.FSServicerequests = append(organization0.R.FSServicerequests, fsServicerequests1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSSpeciesabundances.Insert(bob.ToMods(fsSpeciesabundances1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSSpeciesabundances0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundances1 FSSpeciesabundanceSlice, organization0 *Organization) (FSSpeciesabundanceSlice, error) { + setter := &FSSpeciesabundanceSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsSpeciesabundances1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSSpeciesabundances0: %w", err) + } + + return fsSpeciesabundances1, nil +} + +func (organization0 *Organization) InsertFSSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FSSpeciesabundanceSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsSpeciesabundances1, err := insertOrganizationFSSpeciesabundances0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSSpeciesabundances = append(organization0.R.FSSpeciesabundances, fsSpeciesabundances1...) + + for _, rel := range fsSpeciesabundances1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FSSpeciesabundance) error { + if len(related) == 0 { + return nil + } + + var err error + fsSpeciesabundances1 := FSSpeciesabundanceSlice(related) + + _, err = attachOrganizationFSSpeciesabundances0(ctx, exec, len(related), fsSpeciesabundances1, organization0) + if err != nil { + return err + } + + organization0.R.FSSpeciesabundances = append(organization0.R.FSSpeciesabundances, fsSpeciesabundances1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSStormdrains.Insert(bob.ToMods(fsStormdrains1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSStormdrains0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, count int, fsStormdrains1 FSStormdrainSlice, organization0 *Organization) (FSStormdrainSlice, error) { + setter := &FSStormdrainSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsStormdrains1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSStormdrains0: %w", err) + } + + return fsStormdrains1, nil +} + +func (organization0 *Organization) InsertFSStormdrains(ctx context.Context, exec bob.Executor, related ...*FSStormdrainSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsStormdrains1, err := insertOrganizationFSStormdrains0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSStormdrains = append(organization0.R.FSStormdrains, fsStormdrains1...) + + for _, rel := range fsStormdrains1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSStormdrains(ctx context.Context, exec bob.Executor, related ...*FSStormdrain) error { + if len(related) == 0 { + return nil + } + + var err error + fsStormdrains1 := FSStormdrainSlice(related) + + _, err = attachOrganizationFSStormdrains0(ctx, exec, len(related), fsStormdrains1, organization0) + if err != nil { + return err + } + + organization0.R.FSStormdrains = append(organization0.R.FSStormdrains, fsStormdrains1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSTimecards.Insert(bob.ToMods(fsTimecards1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSTimecards0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, count int, fsTimecards1 FSTimecardSlice, organization0 *Organization) (FSTimecardSlice, error) { + setter := &FSTimecardSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsTimecards1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSTimecards0: %w", err) + } + + return fsTimecards1, nil +} + +func (organization0 *Organization) InsertFSTimecards(ctx context.Context, exec bob.Executor, related ...*FSTimecardSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsTimecards1, err := insertOrganizationFSTimecards0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSTimecards = append(organization0.R.FSTimecards, fsTimecards1...) + + for _, rel := range fsTimecards1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSTimecards(ctx context.Context, exec bob.Executor, related ...*FSTimecard) error { + if len(related) == 0 { + return nil + } + + var err error + fsTimecards1 := FSTimecardSlice(related) + + _, err = attachOrganizationFSTimecards0(ctx, exec, len(related), fsTimecards1, organization0) + if err != nil { + return err + } + + organization0.R.FSTimecards = append(organization0.R.FSTimecards, fsTimecards1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSTrapdata.Insert(bob.ToMods(fsTrapdata1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSTrapdata0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, count int, fsTrapdata1 FSTrapdatumSlice, organization0 *Organization) (FSTrapdatumSlice, error) { + setter := &FSTrapdatumSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsTrapdata1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSTrapdata0: %w", err) + } + + return fsTrapdata1, nil +} + +func (organization0 *Organization) InsertFSTrapdata(ctx context.Context, exec bob.Executor, related ...*FSTrapdatumSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsTrapdata1, err := insertOrganizationFSTrapdata0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSTrapdata = append(organization0.R.FSTrapdata, fsTrapdata1...) + + for _, rel := range fsTrapdata1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSTrapdata(ctx context.Context, exec bob.Executor, related ...*FSTrapdatum) error { + if len(related) == 0 { + return nil + } + + var err error + fsTrapdata1 := FSTrapdatumSlice(related) + + _, err = attachOrganizationFSTrapdata0(ctx, exec, len(related), fsTrapdata1, organization0) + if err != nil { + return err + } + + organization0.R.FSTrapdata = append(organization0.R.FSTrapdata, fsTrapdata1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSTraplocations.Insert(bob.ToMods(fsTraplocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSTraplocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, count int, fsTraplocations1 FSTraplocationSlice, organization0 *Organization) (FSTraplocationSlice, error) { + setter := &FSTraplocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsTraplocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSTraplocations0: %w", err) + } + + return fsTraplocations1, nil +} + +func (organization0 *Organization) InsertFSTraplocations(ctx context.Context, exec bob.Executor, related ...*FSTraplocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsTraplocations1, err := insertOrganizationFSTraplocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSTraplocations = append(organization0.R.FSTraplocations, fsTraplocations1...) + + for _, rel := range fsTraplocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSTraplocations(ctx context.Context, exec bob.Executor, related ...*FSTraplocation) error { + if len(related) == 0 { + return nil + } + + var err error + fsTraplocations1 := FSTraplocationSlice(related) + + _, err = attachOrganizationFSTraplocations0(ctx, exec, len(related), fsTraplocations1, organization0) + if err != nil { + return err + } + + organization0.R.FSTraplocations = append(organization0.R.FSTraplocations, fsTraplocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSTreatments.Insert(bob.ToMods(fsTreatments1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSTreatments0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, count int, fsTreatments1 FSTreatmentSlice, organization0 *Organization) (FSTreatmentSlice, error) { + setter := &FSTreatmentSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsTreatments1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSTreatments0: %w", err) + } + + return fsTreatments1, nil +} + +func (organization0 *Organization) InsertFSTreatments(ctx context.Context, exec bob.Executor, related ...*FSTreatmentSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsTreatments1, err := insertOrganizationFSTreatments0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSTreatments = append(organization0.R.FSTreatments, fsTreatments1...) + + for _, rel := range fsTreatments1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSTreatments(ctx context.Context, exec bob.Executor, related ...*FSTreatment) error { + if len(related) == 0 { + return nil + } + + var err error + fsTreatments1 := FSTreatmentSlice(related) + + _, err = attachOrganizationFSTreatments0(ctx, exec, len(related), fsTreatments1, organization0) + if err != nil { + return err + } + + organization0.R.FSTreatments = append(organization0.R.FSTreatments, fsTreatments1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSTreatmentareas.Insert(bob.ToMods(fsTreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSTreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsTreatmentareas1 FSTreatmentareaSlice, organization0 *Organization) (FSTreatmentareaSlice, error) { + setter := &FSTreatmentareaSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsTreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSTreatmentareas0: %w", err) + } + + return fsTreatmentareas1, nil +} + +func (organization0 *Organization) InsertFSTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSTreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsTreatmentareas1, err := insertOrganizationFSTreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSTreatmentareas = append(organization0.R.FSTreatmentareas, fsTreatmentareas1...) + + for _, rel := range fsTreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSTreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + fsTreatmentareas1 := FSTreatmentareaSlice(related) + + _, err = attachOrganizationFSTreatmentareas0(ctx, exec, len(related), fsTreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.FSTreatmentareas = append(organization0.R.FSTreatmentareas, fsTreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSZones.Insert(bob.ToMods(fsZones1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSZones0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSZones0(ctx context.Context, exec bob.Executor, count int, fsZones1 FSZoneSlice, organization0 *Organization) (FSZoneSlice, error) { + setter := &FSZoneSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsZones1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSZones0: %w", err) + } + + return fsZones1, nil +} + +func (organization0 *Organization) InsertFSZones(ctx context.Context, exec bob.Executor, related ...*FSZoneSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsZones1, err := insertOrganizationFSZones0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSZones = append(organization0.R.FSZones, fsZones1...) + + for _, rel := range fsZones1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSZones(ctx context.Context, exec bob.Executor, related ...*FSZone) error { + if len(related) == 0 { + return nil + } + + var err error + fsZones1 := FSZoneSlice(related) + + _, err = attachOrganizationFSZones0(ctx, exec, len(related), fsZones1, organization0) + if err != nil { + return err + } + + organization0.R.FSZones = append(organization0.R.FSZones, fsZones1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := FSZones2s.Insert(bob.ToMods(fsZones2s1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFSZones2s0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, count int, fsZones2s1 FSZones2Slice, organization0 *Organization) (FSZones2Slice, error) { + setter := &FSZones2Setter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := fsZones2s1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFSZones2s0: %w", err) + } + + return fsZones2s1, nil +} + +func (organization0 *Organization) InsertFSZones2s(ctx context.Context, exec bob.Executor, related ...*FSZones2Setter) error { + if len(related) == 0 { + return nil + } + + var err error + + fsZones2s1, err := insertOrganizationFSZones2s0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FSZones2s = append(organization0.R.FSZones2s, fsZones2s1...) + + for _, rel := range fsZones2s1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFSZones2s(ctx context.Context, exec bob.Executor, related ...*FSZones2) error { + if len(related) == 0 { + return nil + } + + var err error + fsZones2s1 := FSZones2Slice(related) + + _, err = attachOrganizationFSZones2s0(ctx, exec, len(related), fsZones2s1, organization0) + if err != nil { + return err + } + + organization0.R.FSZones2s = append(organization0.R.FSZones2s, fsZones2s1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryContainerrelates.Insert(bob.ToMods(historyContainerrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryContainerrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Executor, count int, historyContainerrelates1 HistoryContainerrelateSlice, organization0 *Organization) (HistoryContainerrelateSlice, error) { + setter := &HistoryContainerrelateSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyContainerrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryContainerrelates0: %w", err) + } + + return historyContainerrelates1, nil +} + +func (organization0 *Organization) InsertHistoryContainerrelates(ctx context.Context, exec bob.Executor, related ...*HistoryContainerrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyContainerrelates1, err := insertOrganizationHistoryContainerrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryContainerrelates = append(organization0.R.HistoryContainerrelates, historyContainerrelates1...) + + for _, rel := range historyContainerrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryContainerrelates(ctx context.Context, exec bob.Executor, related ...*HistoryContainerrelate) error { + if len(related) == 0 { + return nil + } + + var err error + historyContainerrelates1 := HistoryContainerrelateSlice(related) + + _, err = attachOrganizationHistoryContainerrelates0(ctx, exec, len(related), historyContainerrelates1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryContainerrelates = append(organization0.R.HistoryContainerrelates, historyContainerrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryFieldscoutinglogs.Insert(bob.ToMods(historyFieldscoutinglogs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryFieldscoutinglogs0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglogs1 HistoryFieldscoutinglogSlice, organization0 *Organization) (HistoryFieldscoutinglogSlice, error) { + setter := &HistoryFieldscoutinglogSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryFieldscoutinglogs0: %w", err) + } + + return historyFieldscoutinglogs1, nil +} + +func (organization0 *Organization) InsertHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*HistoryFieldscoutinglogSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyFieldscoutinglogs1, err := insertOrganizationHistoryFieldscoutinglogs0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryFieldscoutinglogs = append(organization0.R.HistoryFieldscoutinglogs, historyFieldscoutinglogs1...) + + for _, rel := range historyFieldscoutinglogs1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*HistoryFieldscoutinglog) error { + if len(related) == 0 { + return nil + } + + var err error + historyFieldscoutinglogs1 := HistoryFieldscoutinglogSlice(related) + + _, err = attachOrganizationHistoryFieldscoutinglogs0(ctx, exec, len(related), historyFieldscoutinglogs1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryFieldscoutinglogs = append(organization0.R.HistoryFieldscoutinglogs, historyFieldscoutinglogs1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryHabitatrelates.Insert(bob.ToMods(historyHabitatrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryHabitatrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelates1 HistoryHabitatrelateSlice, organization0 *Organization) (HistoryHabitatrelateSlice, error) { + setter := &HistoryHabitatrelateSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyHabitatrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryHabitatrelates0: %w", err) + } + + return historyHabitatrelates1, nil +} + +func (organization0 *Organization) InsertHistoryHabitatrelates(ctx context.Context, exec bob.Executor, related ...*HistoryHabitatrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyHabitatrelates1, err := insertOrganizationHistoryHabitatrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryHabitatrelates = append(organization0.R.HistoryHabitatrelates, historyHabitatrelates1...) + + for _, rel := range historyHabitatrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryHabitatrelates(ctx context.Context, exec bob.Executor, related ...*HistoryHabitatrelate) error { + if len(related) == 0 { + return nil + } + + var err error + historyHabitatrelates1 := HistoryHabitatrelateSlice(related) + + _, err = attachOrganizationHistoryHabitatrelates0(ctx, exec, len(related), historyHabitatrelates1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryHabitatrelates = append(organization0.R.HistoryHabitatrelates, historyHabitatrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryInspectionsamples.Insert(bob.ToMods(historyInspectionsamples1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryInspectionsamples0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.Executor, count int, historyInspectionsamples1 HistoryInspectionsampleSlice, organization0 *Organization) (HistoryInspectionsampleSlice, error) { + setter := &HistoryInspectionsampleSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyInspectionsamples1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryInspectionsamples0: %w", err) + } + + return historyInspectionsamples1, nil +} + +func (organization0 *Organization) InsertHistoryInspectionsamples(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampleSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyInspectionsamples1, err := insertOrganizationHistoryInspectionsamples0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryInspectionsamples = append(organization0.R.HistoryInspectionsamples, historyInspectionsamples1...) + + for _, rel := range historyInspectionsamples1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryInspectionsamples(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsample) error { + if len(related) == 0 { + return nil + } + + var err error + historyInspectionsamples1 := HistoryInspectionsampleSlice(related) + + _, err = attachOrganizationHistoryInspectionsamples0(ctx, exec, len(related), historyInspectionsamples1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryInspectionsamples = append(organization0.R.HistoryInspectionsamples, historyInspectionsamples1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryInspectionsampledetails.Insert(bob.ToMods(historyInspectionsampledetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryInspectionsampledetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetails1 HistoryInspectionsampledetailSlice, organization0 *Organization) (HistoryInspectionsampledetailSlice, error) { + setter := &HistoryInspectionsampledetailSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyInspectionsampledetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryInspectionsampledetails0: %w", err) + } + + return historyInspectionsampledetails1, nil +} + +func (organization0 *Organization) InsertHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampledetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyInspectionsampledetails1, err := insertOrganizationHistoryInspectionsampledetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryInspectionsampledetails = append(organization0.R.HistoryInspectionsampledetails, historyInspectionsampledetails1...) + + for _, rel := range historyInspectionsampledetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampledetail) error { + if len(related) == 0 { + return nil + } + + var err error + historyInspectionsampledetails1 := HistoryInspectionsampledetailSlice(related) + + _, err = attachOrganizationHistoryInspectionsampledetails0(ctx, exec, len(related), historyInspectionsampledetails1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryInspectionsampledetails = append(organization0.R.HistoryInspectionsampledetails, historyInspectionsampledetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryLinelocations.Insert(bob.ToMods(historyLinelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryLinelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Executor, count int, historyLinelocations1 HistoryLinelocationSlice, organization0 *Organization) (HistoryLinelocationSlice, error) { + setter := &HistoryLinelocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyLinelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryLinelocations0: %w", err) + } + + return historyLinelocations1, nil +} + +func (organization0 *Organization) InsertHistoryLinelocations(ctx context.Context, exec bob.Executor, related ...*HistoryLinelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyLinelocations1, err := insertOrganizationHistoryLinelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryLinelocations = append(organization0.R.HistoryLinelocations, historyLinelocations1...) + + for _, rel := range historyLinelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryLinelocations(ctx context.Context, exec bob.Executor, related ...*HistoryLinelocation) error { + if len(related) == 0 { + return nil + } + + var err error + historyLinelocations1 := HistoryLinelocationSlice(related) + + _, err = attachOrganizationHistoryLinelocations0(ctx, exec, len(related), historyLinelocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryLinelocations = append(organization0.R.HistoryLinelocations, historyLinelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryLocationtrackings.Insert(bob.ToMods(historyLocationtrackings1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryLocationtrackings0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.Executor, count int, historyLocationtrackings1 HistoryLocationtrackingSlice, organization0 *Organization) (HistoryLocationtrackingSlice, error) { + setter := &HistoryLocationtrackingSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyLocationtrackings1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryLocationtrackings0: %w", err) + } + + return historyLocationtrackings1, nil +} + +func (organization0 *Organization) InsertHistoryLocationtrackings(ctx context.Context, exec bob.Executor, related ...*HistoryLocationtrackingSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyLocationtrackings1, err := insertOrganizationHistoryLocationtrackings0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryLocationtrackings = append(organization0.R.HistoryLocationtrackings, historyLocationtrackings1...) + + for _, rel := range historyLocationtrackings1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryLocationtrackings(ctx context.Context, exec bob.Executor, related ...*HistoryLocationtracking) error { + if len(related) == 0 { + return nil + } + + var err error + historyLocationtrackings1 := HistoryLocationtrackingSlice(related) + + _, err = attachOrganizationHistoryLocationtrackings0(ctx, exec, len(related), historyLocationtrackings1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryLocationtrackings = append(organization0.R.HistoryLocationtrackings, historyLocationtrackings1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryMosquitoinspections.Insert(bob.ToMods(historyMosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryMosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspections1 HistoryMosquitoinspectionSlice, organization0 *Organization) (HistoryMosquitoinspectionSlice, error) { + setter := &HistoryMosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyMosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryMosquitoinspections0: %w", err) + } + + return historyMosquitoinspections1, nil +} + +func (organization0 *Organization) InsertHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryMosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyMosquitoinspections1, err := insertOrganizationHistoryMosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryMosquitoinspections = append(organization0.R.HistoryMosquitoinspections, historyMosquitoinspections1...) + + for _, rel := range historyMosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryMosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + historyMosquitoinspections1 := HistoryMosquitoinspectionSlice(related) + + _, err = attachOrganizationHistoryMosquitoinspections0(ctx, exec, len(related), historyMosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryMosquitoinspections = append(organization0.R.HistoryMosquitoinspections, historyMosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryPointlocations.Insert(bob.ToMods(historyPointlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryPointlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Executor, count int, historyPointlocations1 HistoryPointlocationSlice, organization0 *Organization) (HistoryPointlocationSlice, error) { + setter := &HistoryPointlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyPointlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryPointlocations0: %w", err) + } + + return historyPointlocations1, nil +} + +func (organization0 *Organization) InsertHistoryPointlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPointlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyPointlocations1, err := insertOrganizationHistoryPointlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPointlocations = append(organization0.R.HistoryPointlocations, historyPointlocations1...) + + for _, rel := range historyPointlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryPointlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPointlocation) error { + if len(related) == 0 { + return nil + } + + var err error + historyPointlocations1 := HistoryPointlocationSlice(related) + + _, err = attachOrganizationHistoryPointlocations0(ctx, exec, len(related), historyPointlocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPointlocations = append(organization0.R.HistoryPointlocations, historyPointlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryPolygonlocations.Insert(bob.ToMods(historyPolygonlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryPolygonlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocations1 HistoryPolygonlocationSlice, organization0 *Organization) (HistoryPolygonlocationSlice, error) { + setter := &HistoryPolygonlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyPolygonlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryPolygonlocations0: %w", err) + } + + return historyPolygonlocations1, nil +} + +func (organization0 *Organization) InsertHistoryPolygonlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPolygonlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyPolygonlocations1, err := insertOrganizationHistoryPolygonlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPolygonlocations = append(organization0.R.HistoryPolygonlocations, historyPolygonlocations1...) + + for _, rel := range historyPolygonlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryPolygonlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPolygonlocation) error { + if len(related) == 0 { + return nil + } + + var err error + historyPolygonlocations1 := HistoryPolygonlocationSlice(related) + + _, err = attachOrganizationHistoryPolygonlocations0(ctx, exec, len(related), historyPolygonlocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPolygonlocations = append(organization0.R.HistoryPolygonlocations, historyPolygonlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryPools.Insert(bob.ToMods(historyPools1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryPools0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, count int, historyPools1 HistoryPoolSlice, organization0 *Organization) (HistoryPoolSlice, error) { + setter := &HistoryPoolSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyPools1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryPools0: %w", err) + } + + return historyPools1, nil +} + +func (organization0 *Organization) InsertHistoryPools(ctx context.Context, exec bob.Executor, related ...*HistoryPoolSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyPools1, err := insertOrganizationHistoryPools0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPools = append(organization0.R.HistoryPools, historyPools1...) + + for _, rel := range historyPools1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryPools(ctx context.Context, exec bob.Executor, related ...*HistoryPool) error { + if len(related) == 0 { + return nil + } + + var err error + historyPools1 := HistoryPoolSlice(related) + + _, err = attachOrganizationHistoryPools0(ctx, exec, len(related), historyPools1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPools = append(organization0.R.HistoryPools, historyPools1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryPooldetails.Insert(bob.ToMods(historyPooldetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryPooldetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executor, count int, historyPooldetails1 HistoryPooldetailSlice, organization0 *Organization) (HistoryPooldetailSlice, error) { + setter := &HistoryPooldetailSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyPooldetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryPooldetails0: %w", err) + } + + return historyPooldetails1, nil +} + +func (organization0 *Organization) InsertHistoryPooldetails(ctx context.Context, exec bob.Executor, related ...*HistoryPooldetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyPooldetails1, err := insertOrganizationHistoryPooldetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPooldetails = append(organization0.R.HistoryPooldetails, historyPooldetails1...) + + for _, rel := range historyPooldetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryPooldetails(ctx context.Context, exec bob.Executor, related ...*HistoryPooldetail) error { + if len(related) == 0 { + return nil + } + + var err error + historyPooldetails1 := HistoryPooldetailSlice(related) + + _, err = attachOrganizationHistoryPooldetails0(ctx, exec, len(related), historyPooldetails1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryPooldetails = append(organization0.R.HistoryPooldetails, historyPooldetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryProposedtreatmentareas.Insert(bob.ToMods(historyProposedtreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryProposedtreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentareas1 HistoryProposedtreatmentareaSlice, organization0 *Organization) (HistoryProposedtreatmentareaSlice, error) { + setter := &HistoryProposedtreatmentareaSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryProposedtreatmentareas0: %w", err) + } + + return historyProposedtreatmentareas1, nil +} + +func (organization0 *Organization) InsertHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryProposedtreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyProposedtreatmentareas1, err := insertOrganizationHistoryProposedtreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryProposedtreatmentareas = append(organization0.R.HistoryProposedtreatmentareas, historyProposedtreatmentareas1...) + + for _, rel := range historyProposedtreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryProposedtreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + historyProposedtreatmentareas1 := HistoryProposedtreatmentareaSlice(related) + + _, err = attachOrganizationHistoryProposedtreatmentareas0(ctx, exec, len(related), historyProposedtreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryProposedtreatmentareas = append(organization0.R.HistoryProposedtreatmentareas, historyProposedtreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryQamosquitoinspections.Insert(bob.ToMods(historyQamosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryQamosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspections1 HistoryQamosquitoinspectionSlice, organization0 *Organization) (HistoryQamosquitoinspectionSlice, error) { + setter := &HistoryQamosquitoinspectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyQamosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryQamosquitoinspections0: %w", err) + } + + return historyQamosquitoinspections1, nil +} + +func (organization0 *Organization) InsertHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryQamosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyQamosquitoinspections1, err := insertOrganizationHistoryQamosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryQamosquitoinspections = append(organization0.R.HistoryQamosquitoinspections, historyQamosquitoinspections1...) + + for _, rel := range historyQamosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryQamosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + historyQamosquitoinspections1 := HistoryQamosquitoinspectionSlice(related) + + _, err = attachOrganizationHistoryQamosquitoinspections0(ctx, exec, len(related), historyQamosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryQamosquitoinspections = append(organization0.R.HistoryQamosquitoinspections, historyQamosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryRodentlocations.Insert(bob.ToMods(historyRodentlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryRodentlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Executor, count int, historyRodentlocations1 HistoryRodentlocationSlice, organization0 *Organization) (HistoryRodentlocationSlice, error) { + setter := &HistoryRodentlocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyRodentlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryRodentlocations0: %w", err) + } + + return historyRodentlocations1, nil +} + +func (organization0 *Organization) InsertHistoryRodentlocations(ctx context.Context, exec bob.Executor, related ...*HistoryRodentlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyRodentlocations1, err := insertOrganizationHistoryRodentlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryRodentlocations = append(organization0.R.HistoryRodentlocations, historyRodentlocations1...) + + for _, rel := range historyRodentlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryRodentlocations(ctx context.Context, exec bob.Executor, related ...*HistoryRodentlocation) error { + if len(related) == 0 { + return nil + } + + var err error + historyRodentlocations1 := HistoryRodentlocationSlice(related) + + _, err = attachOrganizationHistoryRodentlocations0(ctx, exec, len(related), historyRodentlocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryRodentlocations = append(organization0.R.HistoryRodentlocations, historyRodentlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistorySamplecollections.Insert(bob.ToMods(historySamplecollections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistorySamplecollections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistorySamplecollections0(ctx context.Context, exec bob.Executor, count int, historySamplecollections1 HistorySamplecollectionSlice, organization0 *Organization) (HistorySamplecollectionSlice, error) { + setter := &HistorySamplecollectionSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historySamplecollections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistorySamplecollections0: %w", err) + } + + return historySamplecollections1, nil +} + +func (organization0 *Organization) InsertHistorySamplecollections(ctx context.Context, exec bob.Executor, related ...*HistorySamplecollectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historySamplecollections1, err := insertOrganizationHistorySamplecollections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistorySamplecollections = append(organization0.R.HistorySamplecollections, historySamplecollections1...) + + for _, rel := range historySamplecollections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistorySamplecollections(ctx context.Context, exec bob.Executor, related ...*HistorySamplecollection) error { + if len(related) == 0 { + return nil + } + + var err error + historySamplecollections1 := HistorySamplecollectionSlice(related) + + _, err = attachOrganizationHistorySamplecollections0(ctx, exec, len(related), historySamplecollections1, organization0) + if err != nil { + return err + } + + organization0.R.HistorySamplecollections = append(organization0.R.HistorySamplecollections, historySamplecollections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistorySamplelocations.Insert(bob.ToMods(historySamplelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistorySamplelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Executor, count int, historySamplelocations1 HistorySamplelocationSlice, organization0 *Organization) (HistorySamplelocationSlice, error) { + setter := &HistorySamplelocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historySamplelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistorySamplelocations0: %w", err) + } + + return historySamplelocations1, nil +} + +func (organization0 *Organization) InsertHistorySamplelocations(ctx context.Context, exec bob.Executor, related ...*HistorySamplelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historySamplelocations1, err := insertOrganizationHistorySamplelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistorySamplelocations = append(organization0.R.HistorySamplelocations, historySamplelocations1...) + + for _, rel := range historySamplelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistorySamplelocations(ctx context.Context, exec bob.Executor, related ...*HistorySamplelocation) error { + if len(related) == 0 { + return nil + } + + var err error + historySamplelocations1 := HistorySamplelocationSlice(related) + + _, err = attachOrganizationHistorySamplelocations0(ctx, exec, len(related), historySamplelocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistorySamplelocations = append(organization0.R.HistorySamplelocations, historySamplelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryServicerequests.Insert(bob.ToMods(historyServicerequests1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryServicerequests0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Executor, count int, historyServicerequests1 HistoryServicerequestSlice, organization0 *Organization) (HistoryServicerequestSlice, error) { + setter := &HistoryServicerequestSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyServicerequests1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryServicerequests0: %w", err) + } + + return historyServicerequests1, nil +} + +func (organization0 *Organization) InsertHistoryServicerequests(ctx context.Context, exec bob.Executor, related ...*HistoryServicerequestSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyServicerequests1, err := insertOrganizationHistoryServicerequests0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryServicerequests = append(organization0.R.HistoryServicerequests, historyServicerequests1...) + + for _, rel := range historyServicerequests1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryServicerequests(ctx context.Context, exec bob.Executor, related ...*HistoryServicerequest) error { + if len(related) == 0 { + return nil + } + + var err error + historyServicerequests1 := HistoryServicerequestSlice(related) + + _, err = attachOrganizationHistoryServicerequests0(ctx, exec, len(related), historyServicerequests1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryServicerequests = append(organization0.R.HistoryServicerequests, historyServicerequests1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistorySpeciesabundances.Insert(bob.ToMods(historySpeciesabundances1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistorySpeciesabundances0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundances1 HistorySpeciesabundanceSlice, organization0 *Organization) (HistorySpeciesabundanceSlice, error) { + setter := &HistorySpeciesabundanceSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historySpeciesabundances1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistorySpeciesabundances0: %w", err) + } + + return historySpeciesabundances1, nil +} + +func (organization0 *Organization) InsertHistorySpeciesabundances(ctx context.Context, exec bob.Executor, related ...*HistorySpeciesabundanceSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historySpeciesabundances1, err := insertOrganizationHistorySpeciesabundances0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistorySpeciesabundances = append(organization0.R.HistorySpeciesabundances, historySpeciesabundances1...) + + for _, rel := range historySpeciesabundances1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistorySpeciesabundances(ctx context.Context, exec bob.Executor, related ...*HistorySpeciesabundance) error { + if len(related) == 0 { + return nil + } + + var err error + historySpeciesabundances1 := HistorySpeciesabundanceSlice(related) + + _, err = attachOrganizationHistorySpeciesabundances0(ctx, exec, len(related), historySpeciesabundances1, organization0) + if err != nil { + return err + } + + organization0.R.HistorySpeciesabundances = append(organization0.R.HistorySpeciesabundances, historySpeciesabundances1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryStormdrains.Insert(bob.ToMods(historyStormdrains1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryStormdrains0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executor, count int, historyStormdrains1 HistoryStormdrainSlice, organization0 *Organization) (HistoryStormdrainSlice, error) { + setter := &HistoryStormdrainSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyStormdrains1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryStormdrains0: %w", err) + } + + return historyStormdrains1, nil +} + +func (organization0 *Organization) InsertHistoryStormdrains(ctx context.Context, exec bob.Executor, related ...*HistoryStormdrainSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyStormdrains1, err := insertOrganizationHistoryStormdrains0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryStormdrains = append(organization0.R.HistoryStormdrains, historyStormdrains1...) + + for _, rel := range historyStormdrains1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryStormdrains(ctx context.Context, exec bob.Executor, related ...*HistoryStormdrain) error { + if len(related) == 0 { + return nil + } + + var err error + historyStormdrains1 := HistoryStormdrainSlice(related) + + _, err = attachOrganizationHistoryStormdrains0(ctx, exec, len(related), historyStormdrains1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryStormdrains = append(organization0.R.HistoryStormdrains, historyStormdrains1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryTimecards.Insert(bob.ToMods(historyTimecards1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryTimecards0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, count int, historyTimecards1 HistoryTimecardSlice, organization0 *Organization) (HistoryTimecardSlice, error) { + setter := &HistoryTimecardSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyTimecards1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryTimecards0: %w", err) + } + + return historyTimecards1, nil +} + +func (organization0 *Organization) InsertHistoryTimecards(ctx context.Context, exec bob.Executor, related ...*HistoryTimecardSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyTimecards1, err := insertOrganizationHistoryTimecards0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTimecards = append(organization0.R.HistoryTimecards, historyTimecards1...) + + for _, rel := range historyTimecards1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryTimecards(ctx context.Context, exec bob.Executor, related ...*HistoryTimecard) error { + if len(related) == 0 { + return nil + } + + var err error + historyTimecards1 := HistoryTimecardSlice(related) + + _, err = attachOrganizationHistoryTimecards0(ctx, exec, len(related), historyTimecards1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTimecards = append(organization0.R.HistoryTimecards, historyTimecards1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryTrapdata.Insert(bob.ToMods(historyTrapdata1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryTrapdata0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, count int, historyTrapdata1 HistoryTrapdatumSlice, organization0 *Organization) (HistoryTrapdatumSlice, error) { + setter := &HistoryTrapdatumSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyTrapdata1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryTrapdata0: %w", err) + } + + return historyTrapdata1, nil +} + +func (organization0 *Organization) InsertHistoryTrapdata(ctx context.Context, exec bob.Executor, related ...*HistoryTrapdatumSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyTrapdata1, err := insertOrganizationHistoryTrapdata0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTrapdata = append(organization0.R.HistoryTrapdata, historyTrapdata1...) + + for _, rel := range historyTrapdata1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryTrapdata(ctx context.Context, exec bob.Executor, related ...*HistoryTrapdatum) error { + if len(related) == 0 { + return nil + } + + var err error + historyTrapdata1 := HistoryTrapdatumSlice(related) + + _, err = attachOrganizationHistoryTrapdata0(ctx, exec, len(related), historyTrapdata1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTrapdata = append(organization0.R.HistoryTrapdata, historyTrapdata1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryTraplocations.Insert(bob.ToMods(historyTraplocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryTraplocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Executor, count int, historyTraplocations1 HistoryTraplocationSlice, organization0 *Organization) (HistoryTraplocationSlice, error) { + setter := &HistoryTraplocationSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyTraplocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryTraplocations0: %w", err) + } + + return historyTraplocations1, nil +} + +func (organization0 *Organization) InsertHistoryTraplocations(ctx context.Context, exec bob.Executor, related ...*HistoryTraplocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyTraplocations1, err := insertOrganizationHistoryTraplocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTraplocations = append(organization0.R.HistoryTraplocations, historyTraplocations1...) + + for _, rel := range historyTraplocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryTraplocations(ctx context.Context, exec bob.Executor, related ...*HistoryTraplocation) error { + if len(related) == 0 { + return nil + } + + var err error + historyTraplocations1 := HistoryTraplocationSlice(related) + + _, err = attachOrganizationHistoryTraplocations0(ctx, exec, len(related), historyTraplocations1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTraplocations = append(organization0.R.HistoryTraplocations, historyTraplocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryTreatments.Insert(bob.ToMods(historyTreatments1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryTreatments0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor, count int, historyTreatments1 HistoryTreatmentSlice, organization0 *Organization) (HistoryTreatmentSlice, error) { + setter := &HistoryTreatmentSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyTreatments1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryTreatments0: %w", err) + } + + return historyTreatments1, nil +} + +func (organization0 *Organization) InsertHistoryTreatments(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyTreatments1, err := insertOrganizationHistoryTreatments0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTreatments = append(organization0.R.HistoryTreatments, historyTreatments1...) + + for _, rel := range historyTreatments1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryTreatments(ctx context.Context, exec bob.Executor, related ...*HistoryTreatment) error { + if len(related) == 0 { + return nil + } + + var err error + historyTreatments1 := HistoryTreatmentSlice(related) + + _, err = attachOrganizationHistoryTreatments0(ctx, exec, len(related), historyTreatments1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTreatments = append(organization0.R.HistoryTreatments, historyTreatments1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryTreatmentareas.Insert(bob.ToMods(historyTreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryTreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyTreatmentareas1 HistoryTreatmentareaSlice, organization0 *Organization) (HistoryTreatmentareaSlice, error) { + setter := &HistoryTreatmentareaSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyTreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryTreatmentareas0: %w", err) + } + + return historyTreatmentareas1, nil +} + +func (organization0 *Organization) InsertHistoryTreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyTreatmentareas1, err := insertOrganizationHistoryTreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTreatmentareas = append(organization0.R.HistoryTreatmentareas, historyTreatmentareas1...) + + for _, rel := range historyTreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryTreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + historyTreatmentareas1 := HistoryTreatmentareaSlice(related) + + _, err = attachOrganizationHistoryTreatmentareas0(ctx, exec, len(related), historyTreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryTreatmentareas = append(organization0.R.HistoryTreatmentareas, historyTreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryZones.Insert(bob.ToMods(historyZones1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryZones0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, count int, historyZones1 HistoryZoneSlice, organization0 *Organization) (HistoryZoneSlice, error) { + setter := &HistoryZoneSetter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyZones1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryZones0: %w", err) + } + + return historyZones1, nil +} + +func (organization0 *Organization) InsertHistoryZones(ctx context.Context, exec bob.Executor, related ...*HistoryZoneSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyZones1, err := insertOrganizationHistoryZones0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryZones = append(organization0.R.HistoryZones, historyZones1...) + + for _, rel := range historyZones1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryZones(ctx context.Context, exec bob.Executor, related ...*HistoryZone) error { + if len(related) == 0 { + return nil + } + + var err error + historyZones1 := HistoryZoneSlice(related) + + _, err = attachOrganizationHistoryZones0(ctx, exec, len(related), historyZones1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryZones = append(organization0.R.HistoryZones, historyZones1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +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) + } + + ret, err := HistoryZones2s.Insert(bob.ToMods(historyZones2s1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHistoryZones2s0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, count int, historyZones2s1 HistoryZones2Slice, organization0 *Organization) (HistoryZones2Slice, error) { + setter := &HistoryZones2Setter{ + OrganizationID: omitnull.From(organization0.ID), + } + + err := historyZones2s1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHistoryZones2s0: %w", err) + } + + return historyZones2s1, nil +} + +func (organization0 *Organization) InsertHistoryZones2s(ctx context.Context, exec bob.Executor, related ...*HistoryZones2Setter) error { + if len(related) == 0 { + return nil + } + + var err error + + historyZones2s1, err := insertOrganizationHistoryZones2s0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.HistoryZones2s = append(organization0.R.HistoryZones2s, historyZones2s1...) + + for _, rel := range historyZones2s1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHistoryZones2s(ctx context.Context, exec bob.Executor, related ...*HistoryZones2) error { + if len(related) == 0 { + return nil + } + + var err error + historyZones2s1 := HistoryZones2Slice(related) + + _, err = attachOrganizationHistoryZones2s0(ctx, exec, len(related), historyZones2s1, organization0) + if err != nil { + return err + } + + organization0.R.HistoryZones2s = append(organization0.R.HistoryZones2s, historyZones2s1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + func insertOrganizationUser0(ctx context.Context, exec bob.Executor, users1 []*UserSetter, organization0 *Organization) (UserSlice, error) { for i := range users1 { users1[i].OrganizationID = omitnull.From(organization0.ID) @@ -509,10 +5554,11 @@ func (organization0 *Organization) AttachUser(ctx context.Context, exec bob.Exec } type organizationWhere[Q psql.Filterable] struct { - ID psql.WhereMod[Q, int32] - Name psql.WhereNullMod[Q, string] - ArcgisID psql.WhereNullMod[Q, string] - ArcgisName psql.WhereNullMod[Q, string] + ID psql.WhereMod[Q, int32] + Name psql.WhereNullMod[Q, string] + ArcgisID psql.WhereNullMod[Q, string] + ArcgisName psql.WhereNullMod[Q, string] + FieldseekerURL psql.WhereNullMod[Q, string] } func (organizationWhere[Q]) AliasedAs(alias string) organizationWhere[Q] { @@ -521,10 +5567,11 @@ func (organizationWhere[Q]) AliasedAs(alias string) organizationWhere[Q] { func buildOrganizationWhere[Q psql.Filterable](cols organizationColumns) organizationWhere[Q] { return organizationWhere[Q]{ - ID: psql.Where[Q, int32](cols.ID), - Name: psql.WhereNull[Q, string](cols.Name), - ArcgisID: psql.WhereNull[Q, string](cols.ArcgisID), - ArcgisName: psql.WhereNull[Q, string](cols.ArcgisName), + ID: psql.Where[Q, int32](cols.ID), + Name: psql.WhereNull[Q, string](cols.Name), + ArcgisID: psql.WhereNull[Q, string](cols.ArcgisID), + ArcgisName: psql.WhereNull[Q, string](cols.ArcgisName), + FieldseekerURL: psql.WhereNull[Q, string](cols.FieldseekerURL), } } @@ -534,6 +5581,762 @@ func (o *Organization) Preload(name string, retrieved any) error { } switch name { + case "FSContainerrelates": + rels, ok := retrieved.(FSContainerrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSContainerrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSFieldscoutinglogs": + rels, ok := retrieved.(FSFieldscoutinglogSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSFieldscoutinglogs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSHabitatrelates": + rels, ok := retrieved.(FSHabitatrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSHabitatrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSInspectionsamples": + rels, ok := retrieved.(FSInspectionsampleSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSInspectionsamples = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSInspectionsampledetails": + rels, ok := retrieved.(FSInspectionsampledetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSInspectionsampledetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSLinelocations": + rels, ok := retrieved.(FSLinelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSLinelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSLocationtrackings": + rels, ok := retrieved.(FSLocationtrackingSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSLocationtrackings = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSMosquitoinspections": + rels, ok := retrieved.(FSMosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSMosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSPointlocations": + rels, ok := retrieved.(FSPointlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSPointlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSPolygonlocations": + rels, ok := retrieved.(FSPolygonlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSPolygonlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSPools": + rels, ok := retrieved.(FSPoolSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSPools = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSPooldetails": + rels, ok := retrieved.(FSPooldetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSPooldetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSProposedtreatmentareas": + rels, ok := retrieved.(FSProposedtreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSProposedtreatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSQamosquitoinspections": + rels, ok := retrieved.(FSQamosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSQamosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSRodentlocations": + rels, ok := retrieved.(FSRodentlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSRodentlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSSamplecollections": + rels, ok := retrieved.(FSSamplecollectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSSamplecollections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSSamplelocations": + rels, ok := retrieved.(FSSamplelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSSamplelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSServicerequests": + rels, ok := retrieved.(FSServicerequestSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSServicerequests = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSSpeciesabundances": + rels, ok := retrieved.(FSSpeciesabundanceSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSSpeciesabundances = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSStormdrains": + rels, ok := retrieved.(FSStormdrainSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSStormdrains = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSTimecards": + rels, ok := retrieved.(FSTimecardSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSTimecards = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSTrapdata": + rels, ok := retrieved.(FSTrapdatumSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSTrapdata = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSTraplocations": + rels, ok := retrieved.(FSTraplocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSTraplocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSTreatments": + rels, ok := retrieved.(FSTreatmentSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSTreatments = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSTreatmentareas": + rels, ok := retrieved.(FSTreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSTreatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSZones": + rels, ok := retrieved.(FSZoneSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSZones = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "FSZones2s": + rels, ok := retrieved.(FSZones2Slice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FSZones2s = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryContainerrelates": + rels, ok := retrieved.(HistoryContainerrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryContainerrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryFieldscoutinglogs": + rels, ok := retrieved.(HistoryFieldscoutinglogSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryFieldscoutinglogs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryHabitatrelates": + rels, ok := retrieved.(HistoryHabitatrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryHabitatrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryInspectionsamples": + rels, ok := retrieved.(HistoryInspectionsampleSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryInspectionsamples = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryInspectionsampledetails": + rels, ok := retrieved.(HistoryInspectionsampledetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryInspectionsampledetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryLinelocations": + rels, ok := retrieved.(HistoryLinelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryLinelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryLocationtrackings": + rels, ok := retrieved.(HistoryLocationtrackingSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryLocationtrackings = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryMosquitoinspections": + rels, ok := retrieved.(HistoryMosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryMosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryPointlocations": + rels, ok := retrieved.(HistoryPointlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryPointlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryPolygonlocations": + rels, ok := retrieved.(HistoryPolygonlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryPolygonlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryPools": + rels, ok := retrieved.(HistoryPoolSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryPools = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryPooldetails": + rels, ok := retrieved.(HistoryPooldetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryPooldetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryProposedtreatmentareas": + rels, ok := retrieved.(HistoryProposedtreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryProposedtreatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryQamosquitoinspections": + rels, ok := retrieved.(HistoryQamosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryQamosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryRodentlocations": + rels, ok := retrieved.(HistoryRodentlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryRodentlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistorySamplecollections": + rels, ok := retrieved.(HistorySamplecollectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistorySamplecollections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistorySamplelocations": + rels, ok := retrieved.(HistorySamplelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistorySamplelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryServicerequests": + rels, ok := retrieved.(HistoryServicerequestSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryServicerequests = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistorySpeciesabundances": + rels, ok := retrieved.(HistorySpeciesabundanceSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistorySpeciesabundances = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryStormdrains": + rels, ok := retrieved.(HistoryStormdrainSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryStormdrains = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryTimecards": + rels, ok := retrieved.(HistoryTimecardSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryTimecards = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryTrapdata": + rels, ok := retrieved.(HistoryTrapdatumSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryTrapdata = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryTraplocations": + rels, ok := retrieved.(HistoryTraplocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryTraplocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryTreatments": + rels, ok := retrieved.(HistoryTreatmentSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryTreatments = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryTreatmentareas": + rels, ok := retrieved.(HistoryTreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryTreatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryZones": + rels, ok := retrieved.(HistoryZoneSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryZones = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "HistoryZones2s": + rels, ok := retrieved.(HistoryZones2Slice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.HistoryZones2s = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil case "User": rels, ok := retrieved.(UserSlice) if !ok { @@ -560,15 +6363,555 @@ func buildOrganizationPreloader() organizationPreloader { } type organizationThenLoader[Q orm.Loadable] struct { - User 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] + FSInspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSInspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSLinelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSLocationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSMosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSPointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSPolygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSPooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSProposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSQamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSRodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSSamplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSSamplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSServicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSSpeciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSStormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSTimecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSTrapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSTraplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSTreatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSTreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSZones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FSZones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryContainerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryFieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryHabitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryInspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryInspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryLinelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryLocationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryMosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryPointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryPolygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryPooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryProposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryQamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryRodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistorySamplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistorySamplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryServicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistorySpeciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryStormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryTimecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryTrapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryTraplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryTreatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryTreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryZones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + HistoryZones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { + type FSContainerrelatesLoadInterface interface { + LoadFSContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSFieldscoutinglogsLoadInterface interface { + LoadFSFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSHabitatrelatesLoadInterface interface { + LoadFSHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSInspectionsamplesLoadInterface interface { + LoadFSInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSInspectionsampledetailsLoadInterface interface { + LoadFSInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSLinelocationsLoadInterface interface { + LoadFSLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSLocationtrackingsLoadInterface interface { + LoadFSLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSMosquitoinspectionsLoadInterface interface { + LoadFSMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSPointlocationsLoadInterface interface { + LoadFSPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSPolygonlocationsLoadInterface interface { + LoadFSPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSPoolsLoadInterface interface { + LoadFSPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSPooldetailsLoadInterface interface { + LoadFSPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSProposedtreatmentareasLoadInterface interface { + LoadFSProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSQamosquitoinspectionsLoadInterface interface { + LoadFSQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSRodentlocationsLoadInterface interface { + LoadFSRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSSamplecollectionsLoadInterface interface { + LoadFSSamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSSamplelocationsLoadInterface interface { + LoadFSSamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSServicerequestsLoadInterface interface { + LoadFSServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSSpeciesabundancesLoadInterface interface { + LoadFSSpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSStormdrainsLoadInterface interface { + LoadFSStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSTimecardsLoadInterface interface { + LoadFSTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSTrapdataLoadInterface interface { + LoadFSTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSTraplocationsLoadInterface interface { + LoadFSTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSTreatmentsLoadInterface interface { + LoadFSTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSTreatmentareasLoadInterface interface { + LoadFSTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSZonesLoadInterface interface { + LoadFSZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FSZones2sLoadInterface interface { + LoadFSZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryContainerrelatesLoadInterface interface { + LoadHistoryContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryFieldscoutinglogsLoadInterface interface { + LoadHistoryFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryHabitatrelatesLoadInterface interface { + LoadHistoryHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryInspectionsamplesLoadInterface interface { + LoadHistoryInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryInspectionsampledetailsLoadInterface interface { + LoadHistoryInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryLinelocationsLoadInterface interface { + LoadHistoryLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryLocationtrackingsLoadInterface interface { + LoadHistoryLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryMosquitoinspectionsLoadInterface interface { + LoadHistoryMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryPointlocationsLoadInterface interface { + LoadHistoryPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryPolygonlocationsLoadInterface interface { + LoadHistoryPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryPoolsLoadInterface interface { + LoadHistoryPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryPooldetailsLoadInterface interface { + LoadHistoryPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryProposedtreatmentareasLoadInterface interface { + LoadHistoryProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryQamosquitoinspectionsLoadInterface interface { + LoadHistoryQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryRodentlocationsLoadInterface interface { + LoadHistoryRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistorySamplecollectionsLoadInterface interface { + LoadHistorySamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistorySamplelocationsLoadInterface interface { + LoadHistorySamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryServicerequestsLoadInterface interface { + LoadHistoryServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistorySpeciesabundancesLoadInterface interface { + LoadHistorySpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryStormdrainsLoadInterface interface { + LoadHistoryStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryTimecardsLoadInterface interface { + LoadHistoryTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryTrapdataLoadInterface interface { + LoadHistoryTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryTraplocationsLoadInterface interface { + LoadHistoryTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryTreatmentsLoadInterface interface { + LoadHistoryTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryTreatmentareasLoadInterface interface { + LoadHistoryTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryZonesLoadInterface interface { + LoadHistoryZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HistoryZones2sLoadInterface interface { + LoadHistoryZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type UserLoadInterface interface { LoadUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } return organizationThenLoader[Q]{ + FSContainerrelates: thenLoadBuilder[Q]( + "FSContainerrelates", + func(ctx context.Context, exec bob.Executor, retrieved FSContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSContainerrelates(ctx, exec, mods...) + }, + ), + FSFieldscoutinglogs: thenLoadBuilder[Q]( + "FSFieldscoutinglogs", + func(ctx context.Context, exec bob.Executor, retrieved FSFieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSFieldscoutinglogs(ctx, exec, mods...) + }, + ), + FSHabitatrelates: thenLoadBuilder[Q]( + "FSHabitatrelates", + func(ctx context.Context, exec bob.Executor, retrieved FSHabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSHabitatrelates(ctx, exec, mods...) + }, + ), + FSInspectionsamples: thenLoadBuilder[Q]( + "FSInspectionsamples", + func(ctx context.Context, exec bob.Executor, retrieved FSInspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSInspectionsamples(ctx, exec, mods...) + }, + ), + FSInspectionsampledetails: thenLoadBuilder[Q]( + "FSInspectionsampledetails", + func(ctx context.Context, exec bob.Executor, retrieved FSInspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSInspectionsampledetails(ctx, exec, mods...) + }, + ), + FSLinelocations: thenLoadBuilder[Q]( + "FSLinelocations", + func(ctx context.Context, exec bob.Executor, retrieved FSLinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSLinelocations(ctx, exec, mods...) + }, + ), + FSLocationtrackings: thenLoadBuilder[Q]( + "FSLocationtrackings", + func(ctx context.Context, exec bob.Executor, retrieved FSLocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSLocationtrackings(ctx, exec, mods...) + }, + ), + FSMosquitoinspections: thenLoadBuilder[Q]( + "FSMosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved FSMosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSMosquitoinspections(ctx, exec, mods...) + }, + ), + FSPointlocations: thenLoadBuilder[Q]( + "FSPointlocations", + func(ctx context.Context, exec bob.Executor, retrieved FSPointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSPointlocations(ctx, exec, mods...) + }, + ), + FSPolygonlocations: thenLoadBuilder[Q]( + "FSPolygonlocations", + func(ctx context.Context, exec bob.Executor, retrieved FSPolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSPolygonlocations(ctx, exec, mods...) + }, + ), + FSPools: thenLoadBuilder[Q]( + "FSPools", + func(ctx context.Context, exec bob.Executor, retrieved FSPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSPools(ctx, exec, mods...) + }, + ), + FSPooldetails: thenLoadBuilder[Q]( + "FSPooldetails", + func(ctx context.Context, exec bob.Executor, retrieved FSPooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSPooldetails(ctx, exec, mods...) + }, + ), + FSProposedtreatmentareas: thenLoadBuilder[Q]( + "FSProposedtreatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved FSProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSProposedtreatmentareas(ctx, exec, mods...) + }, + ), + FSQamosquitoinspections: thenLoadBuilder[Q]( + "FSQamosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved FSQamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSQamosquitoinspections(ctx, exec, mods...) + }, + ), + FSRodentlocations: thenLoadBuilder[Q]( + "FSRodentlocations", + func(ctx context.Context, exec bob.Executor, retrieved FSRodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSRodentlocations(ctx, exec, mods...) + }, + ), + FSSamplecollections: thenLoadBuilder[Q]( + "FSSamplecollections", + func(ctx context.Context, exec bob.Executor, retrieved FSSamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSSamplecollections(ctx, exec, mods...) + }, + ), + FSSamplelocations: thenLoadBuilder[Q]( + "FSSamplelocations", + func(ctx context.Context, exec bob.Executor, retrieved FSSamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSSamplelocations(ctx, exec, mods...) + }, + ), + FSServicerequests: thenLoadBuilder[Q]( + "FSServicerequests", + func(ctx context.Context, exec bob.Executor, retrieved FSServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSServicerequests(ctx, exec, mods...) + }, + ), + FSSpeciesabundances: thenLoadBuilder[Q]( + "FSSpeciesabundances", + func(ctx context.Context, exec bob.Executor, retrieved FSSpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSSpeciesabundances(ctx, exec, mods...) + }, + ), + FSStormdrains: thenLoadBuilder[Q]( + "FSStormdrains", + func(ctx context.Context, exec bob.Executor, retrieved FSStormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSStormdrains(ctx, exec, mods...) + }, + ), + FSTimecards: thenLoadBuilder[Q]( + "FSTimecards", + func(ctx context.Context, exec bob.Executor, retrieved FSTimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSTimecards(ctx, exec, mods...) + }, + ), + FSTrapdata: thenLoadBuilder[Q]( + "FSTrapdata", + func(ctx context.Context, exec bob.Executor, retrieved FSTrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSTrapdata(ctx, exec, mods...) + }, + ), + FSTraplocations: thenLoadBuilder[Q]( + "FSTraplocations", + func(ctx context.Context, exec bob.Executor, retrieved FSTraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSTraplocations(ctx, exec, mods...) + }, + ), + FSTreatments: thenLoadBuilder[Q]( + "FSTreatments", + func(ctx context.Context, exec bob.Executor, retrieved FSTreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSTreatments(ctx, exec, mods...) + }, + ), + FSTreatmentareas: thenLoadBuilder[Q]( + "FSTreatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved FSTreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSTreatmentareas(ctx, exec, mods...) + }, + ), + FSZones: thenLoadBuilder[Q]( + "FSZones", + func(ctx context.Context, exec bob.Executor, retrieved FSZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSZones(ctx, exec, mods...) + }, + ), + FSZones2s: thenLoadBuilder[Q]( + "FSZones2s", + func(ctx context.Context, exec bob.Executor, retrieved FSZones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFSZones2s(ctx, exec, mods...) + }, + ), + HistoryContainerrelates: thenLoadBuilder[Q]( + "HistoryContainerrelates", + func(ctx context.Context, exec bob.Executor, retrieved HistoryContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryContainerrelates(ctx, exec, mods...) + }, + ), + HistoryFieldscoutinglogs: thenLoadBuilder[Q]( + "HistoryFieldscoutinglogs", + func(ctx context.Context, exec bob.Executor, retrieved HistoryFieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryFieldscoutinglogs(ctx, exec, mods...) + }, + ), + HistoryHabitatrelates: thenLoadBuilder[Q]( + "HistoryHabitatrelates", + func(ctx context.Context, exec bob.Executor, retrieved HistoryHabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryHabitatrelates(ctx, exec, mods...) + }, + ), + HistoryInspectionsamples: thenLoadBuilder[Q]( + "HistoryInspectionsamples", + func(ctx context.Context, exec bob.Executor, retrieved HistoryInspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryInspectionsamples(ctx, exec, mods...) + }, + ), + HistoryInspectionsampledetails: thenLoadBuilder[Q]( + "HistoryInspectionsampledetails", + func(ctx context.Context, exec bob.Executor, retrieved HistoryInspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryInspectionsampledetails(ctx, exec, mods...) + }, + ), + HistoryLinelocations: thenLoadBuilder[Q]( + "HistoryLinelocations", + func(ctx context.Context, exec bob.Executor, retrieved HistoryLinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryLinelocations(ctx, exec, mods...) + }, + ), + HistoryLocationtrackings: thenLoadBuilder[Q]( + "HistoryLocationtrackings", + func(ctx context.Context, exec bob.Executor, retrieved HistoryLocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryLocationtrackings(ctx, exec, mods...) + }, + ), + HistoryMosquitoinspections: thenLoadBuilder[Q]( + "HistoryMosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved HistoryMosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryMosquitoinspections(ctx, exec, mods...) + }, + ), + HistoryPointlocations: thenLoadBuilder[Q]( + "HistoryPointlocations", + func(ctx context.Context, exec bob.Executor, retrieved HistoryPointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryPointlocations(ctx, exec, mods...) + }, + ), + HistoryPolygonlocations: thenLoadBuilder[Q]( + "HistoryPolygonlocations", + func(ctx context.Context, exec bob.Executor, retrieved HistoryPolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryPolygonlocations(ctx, exec, mods...) + }, + ), + HistoryPools: thenLoadBuilder[Q]( + "HistoryPools", + func(ctx context.Context, exec bob.Executor, retrieved HistoryPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryPools(ctx, exec, mods...) + }, + ), + HistoryPooldetails: thenLoadBuilder[Q]( + "HistoryPooldetails", + func(ctx context.Context, exec bob.Executor, retrieved HistoryPooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryPooldetails(ctx, exec, mods...) + }, + ), + HistoryProposedtreatmentareas: thenLoadBuilder[Q]( + "HistoryProposedtreatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved HistoryProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryProposedtreatmentareas(ctx, exec, mods...) + }, + ), + HistoryQamosquitoinspections: thenLoadBuilder[Q]( + "HistoryQamosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved HistoryQamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryQamosquitoinspections(ctx, exec, mods...) + }, + ), + HistoryRodentlocations: thenLoadBuilder[Q]( + "HistoryRodentlocations", + func(ctx context.Context, exec bob.Executor, retrieved HistoryRodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryRodentlocations(ctx, exec, mods...) + }, + ), + HistorySamplecollections: thenLoadBuilder[Q]( + "HistorySamplecollections", + func(ctx context.Context, exec bob.Executor, retrieved HistorySamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistorySamplecollections(ctx, exec, mods...) + }, + ), + HistorySamplelocations: thenLoadBuilder[Q]( + "HistorySamplelocations", + func(ctx context.Context, exec bob.Executor, retrieved HistorySamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistorySamplelocations(ctx, exec, mods...) + }, + ), + HistoryServicerequests: thenLoadBuilder[Q]( + "HistoryServicerequests", + func(ctx context.Context, exec bob.Executor, retrieved HistoryServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryServicerequests(ctx, exec, mods...) + }, + ), + HistorySpeciesabundances: thenLoadBuilder[Q]( + "HistorySpeciesabundances", + func(ctx context.Context, exec bob.Executor, retrieved HistorySpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistorySpeciesabundances(ctx, exec, mods...) + }, + ), + HistoryStormdrains: thenLoadBuilder[Q]( + "HistoryStormdrains", + func(ctx context.Context, exec bob.Executor, retrieved HistoryStormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryStormdrains(ctx, exec, mods...) + }, + ), + HistoryTimecards: thenLoadBuilder[Q]( + "HistoryTimecards", + func(ctx context.Context, exec bob.Executor, retrieved HistoryTimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryTimecards(ctx, exec, mods...) + }, + ), + HistoryTrapdata: thenLoadBuilder[Q]( + "HistoryTrapdata", + func(ctx context.Context, exec bob.Executor, retrieved HistoryTrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryTrapdata(ctx, exec, mods...) + }, + ), + HistoryTraplocations: thenLoadBuilder[Q]( + "HistoryTraplocations", + func(ctx context.Context, exec bob.Executor, retrieved HistoryTraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryTraplocations(ctx, exec, mods...) + }, + ), + HistoryTreatments: thenLoadBuilder[Q]( + "HistoryTreatments", + func(ctx context.Context, exec bob.Executor, retrieved HistoryTreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryTreatments(ctx, exec, mods...) + }, + ), + HistoryTreatmentareas: thenLoadBuilder[Q]( + "HistoryTreatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved HistoryTreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryTreatmentareas(ctx, exec, mods...) + }, + ), + HistoryZones: thenLoadBuilder[Q]( + "HistoryZones", + func(ctx context.Context, exec bob.Executor, retrieved HistoryZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryZones(ctx, exec, mods...) + }, + ), + HistoryZones2s: thenLoadBuilder[Q]( + "HistoryZones2s", + func(ctx context.Context, exec bob.Executor, retrieved HistoryZones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHistoryZones2s(ctx, exec, mods...) + }, + ), User: thenLoadBuilder[Q]( "User", func(ctx context.Context, exec bob.Executor, retrieved UserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -578,6 +6921,3462 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { } } +// 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 { + return nil + } + + // Reset the relationship + o.R.FSContainerrelates = nil + + related, err := o.FSContainerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSContainerrelates = related + return nil +} + +// LoadFSContainerrelates loads the organization's FSContainerrelates into the .R struct +func (os OrganizationSlice) LoadFSContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsContainerrelates, err := os.FSContainerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSContainerrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsContainerrelates { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSContainerrelates = append(o.R.FSContainerrelates, rel) + } + } + + return nil +} + +// LoadFSFieldscoutinglogs loads the organization's FSFieldscoutinglogs into the .R struct +func (o *Organization) LoadFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSFieldscoutinglogs = nil + + related, err := o.FSFieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSFieldscoutinglogs = related + return nil +} + +// LoadFSFieldscoutinglogs loads the organization's FSFieldscoutinglogs into the .R struct +func (os OrganizationSlice) LoadFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsFieldscoutinglogs, err := os.FSFieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSFieldscoutinglogs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsFieldscoutinglogs { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSFieldscoutinglogs = append(o.R.FSFieldscoutinglogs, rel) + } + } + + return nil +} + +// LoadFSHabitatrelates loads the organization's FSHabitatrelates into the .R struct +func (o *Organization) LoadFSHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSHabitatrelates = nil + + related, err := o.FSHabitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSHabitatrelates = related + return nil +} + +// LoadFSHabitatrelates loads the organization's FSHabitatrelates into the .R struct +func (os OrganizationSlice) LoadFSHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsHabitatrelates, err := os.FSHabitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSHabitatrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsHabitatrelates { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSHabitatrelates = append(o.R.FSHabitatrelates, rel) + } + } + + return nil +} + +// LoadFSInspectionsamples loads the organization's FSInspectionsamples into the .R struct +func (o *Organization) LoadFSInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSInspectionsamples = nil + + related, err := o.FSInspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSInspectionsamples = related + return nil +} + +// LoadFSInspectionsamples loads the organization's FSInspectionsamples into the .R struct +func (os OrganizationSlice) LoadFSInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsInspectionsamples, err := os.FSInspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSInspectionsamples = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsInspectionsamples { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSInspectionsamples = append(o.R.FSInspectionsamples, rel) + } + } + + return nil +} + +// LoadFSInspectionsampledetails loads the organization's FSInspectionsampledetails into the .R struct +func (o *Organization) LoadFSInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSInspectionsampledetails = nil + + related, err := o.FSInspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSInspectionsampledetails = related + return nil +} + +// LoadFSInspectionsampledetails loads the organization's FSInspectionsampledetails into the .R struct +func (os OrganizationSlice) LoadFSInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsInspectionsampledetails, err := os.FSInspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSInspectionsampledetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsInspectionsampledetails { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSInspectionsampledetails = append(o.R.FSInspectionsampledetails, rel) + } + } + + return nil +} + +// LoadFSLinelocations loads the organization's FSLinelocations into the .R struct +func (o *Organization) LoadFSLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSLinelocations = nil + + related, err := o.FSLinelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSLinelocations = related + return nil +} + +// LoadFSLinelocations loads the organization's FSLinelocations into the .R struct +func (os OrganizationSlice) LoadFSLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsLinelocations, err := os.FSLinelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSLinelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsLinelocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSLinelocations = append(o.R.FSLinelocations, rel) + } + } + + return nil +} + +// LoadFSLocationtrackings loads the organization's FSLocationtrackings into the .R struct +func (o *Organization) LoadFSLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSLocationtrackings = nil + + related, err := o.FSLocationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSLocationtrackings = related + return nil +} + +// LoadFSLocationtrackings loads the organization's FSLocationtrackings into the .R struct +func (os OrganizationSlice) LoadFSLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsLocationtrackings, err := os.FSLocationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSLocationtrackings = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsLocationtrackings { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSLocationtrackings = append(o.R.FSLocationtrackings, rel) + } + } + + return nil +} + +// LoadFSMosquitoinspections loads the organization's FSMosquitoinspections into the .R struct +func (o *Organization) LoadFSMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSMosquitoinspections = nil + + related, err := o.FSMosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSMosquitoinspections = related + return nil +} + +// LoadFSMosquitoinspections loads the organization's FSMosquitoinspections into the .R struct +func (os OrganizationSlice) LoadFSMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsMosquitoinspections, err := os.FSMosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSMosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsMosquitoinspections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSMosquitoinspections = append(o.R.FSMosquitoinspections, rel) + } + } + + return nil +} + +// LoadFSPointlocations loads the organization's FSPointlocations into the .R struct +func (o *Organization) LoadFSPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSPointlocations = nil + + related, err := o.FSPointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSPointlocations = related + return nil +} + +// LoadFSPointlocations loads the organization's FSPointlocations into the .R struct +func (os OrganizationSlice) LoadFSPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsPointlocations, err := os.FSPointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSPointlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsPointlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSPointlocations = append(o.R.FSPointlocations, rel) + } + } + + return nil +} + +// LoadFSPolygonlocations loads the organization's FSPolygonlocations into the .R struct +func (o *Organization) LoadFSPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSPolygonlocations = nil + + related, err := o.FSPolygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSPolygonlocations = related + return nil +} + +// LoadFSPolygonlocations loads the organization's FSPolygonlocations into the .R struct +func (os OrganizationSlice) LoadFSPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsPolygonlocations, err := os.FSPolygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSPolygonlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsPolygonlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSPolygonlocations = append(o.R.FSPolygonlocations, rel) + } + } + + return nil +} + +// LoadFSPools loads the organization's FSPools into the .R struct +func (o *Organization) LoadFSPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSPools = nil + + related, err := o.FSPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSPools = related + return nil +} + +// LoadFSPools loads the organization's FSPools into the .R struct +func (os OrganizationSlice) LoadFSPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsPools, err := os.FSPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSPools = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsPools { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSPools = append(o.R.FSPools, rel) + } + } + + return nil +} + +// LoadFSPooldetails loads the organization's FSPooldetails into the .R struct +func (o *Organization) LoadFSPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSPooldetails = nil + + related, err := o.FSPooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSPooldetails = related + return nil +} + +// LoadFSPooldetails loads the organization's FSPooldetails into the .R struct +func (os OrganizationSlice) LoadFSPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsPooldetails, err := os.FSPooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSPooldetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsPooldetails { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSPooldetails = append(o.R.FSPooldetails, rel) + } + } + + return nil +} + +// LoadFSProposedtreatmentareas loads the organization's FSProposedtreatmentareas into the .R struct +func (o *Organization) LoadFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSProposedtreatmentareas = nil + + related, err := o.FSProposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSProposedtreatmentareas = related + return nil +} + +// LoadFSProposedtreatmentareas loads the organization's FSProposedtreatmentareas into the .R struct +func (os OrganizationSlice) LoadFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsProposedtreatmentareas, err := os.FSProposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSProposedtreatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsProposedtreatmentareas { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSProposedtreatmentareas = append(o.R.FSProposedtreatmentareas, rel) + } + } + + return nil +} + +// LoadFSQamosquitoinspections loads the organization's FSQamosquitoinspections into the .R struct +func (o *Organization) LoadFSQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSQamosquitoinspections = nil + + related, err := o.FSQamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSQamosquitoinspections = related + return nil +} + +// LoadFSQamosquitoinspections loads the organization's FSQamosquitoinspections into the .R struct +func (os OrganizationSlice) LoadFSQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsQamosquitoinspections, err := os.FSQamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSQamosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsQamosquitoinspections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSQamosquitoinspections = append(o.R.FSQamosquitoinspections, rel) + } + } + + return nil +} + +// LoadFSRodentlocations loads the organization's FSRodentlocations into the .R struct +func (o *Organization) LoadFSRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSRodentlocations = nil + + related, err := o.FSRodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSRodentlocations = related + return nil +} + +// LoadFSRodentlocations loads the organization's FSRodentlocations into the .R struct +func (os OrganizationSlice) LoadFSRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsRodentlocations, err := os.FSRodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSRodentlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsRodentlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSRodentlocations = append(o.R.FSRodentlocations, rel) + } + } + + return nil +} + +// LoadFSSamplecollections loads the organization's FSSamplecollections into the .R struct +func (o *Organization) LoadFSSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSSamplecollections = nil + + related, err := o.FSSamplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSSamplecollections = related + return nil +} + +// LoadFSSamplecollections loads the organization's FSSamplecollections into the .R struct +func (os OrganizationSlice) LoadFSSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsSamplecollections, err := os.FSSamplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSSamplecollections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsSamplecollections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSSamplecollections = append(o.R.FSSamplecollections, rel) + } + } + + return nil +} + +// LoadFSSamplelocations loads the organization's FSSamplelocations into the .R struct +func (o *Organization) LoadFSSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSSamplelocations = nil + + related, err := o.FSSamplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSSamplelocations = related + return nil +} + +// LoadFSSamplelocations loads the organization's FSSamplelocations into the .R struct +func (os OrganizationSlice) LoadFSSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsSamplelocations, err := os.FSSamplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSSamplelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsSamplelocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSSamplelocations = append(o.R.FSSamplelocations, rel) + } + } + + return nil +} + +// LoadFSServicerequests loads the organization's FSServicerequests into the .R struct +func (o *Organization) LoadFSServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSServicerequests = nil + + related, err := o.FSServicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSServicerequests = related + return nil +} + +// LoadFSServicerequests loads the organization's FSServicerequests into the .R struct +func (os OrganizationSlice) LoadFSServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsServicerequests, err := os.FSServicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSServicerequests = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsServicerequests { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSServicerequests = append(o.R.FSServicerequests, rel) + } + } + + return nil +} + +// LoadFSSpeciesabundances loads the organization's FSSpeciesabundances into the .R struct +func (o *Organization) LoadFSSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSSpeciesabundances = nil + + related, err := o.FSSpeciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSSpeciesabundances = related + return nil +} + +// LoadFSSpeciesabundances loads the organization's FSSpeciesabundances into the .R struct +func (os OrganizationSlice) LoadFSSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsSpeciesabundances, err := os.FSSpeciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSSpeciesabundances = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsSpeciesabundances { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSSpeciesabundances = append(o.R.FSSpeciesabundances, rel) + } + } + + return nil +} + +// LoadFSStormdrains loads the organization's FSStormdrains into the .R struct +func (o *Organization) LoadFSStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSStormdrains = nil + + related, err := o.FSStormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSStormdrains = related + return nil +} + +// LoadFSStormdrains loads the organization's FSStormdrains into the .R struct +func (os OrganizationSlice) LoadFSStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsStormdrains, err := os.FSStormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSStormdrains = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsStormdrains { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSStormdrains = append(o.R.FSStormdrains, rel) + } + } + + return nil +} + +// LoadFSTimecards loads the organization's FSTimecards into the .R struct +func (o *Organization) LoadFSTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSTimecards = nil + + related, err := o.FSTimecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSTimecards = related + return nil +} + +// LoadFSTimecards loads the organization's FSTimecards into the .R struct +func (os OrganizationSlice) LoadFSTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsTimecards, err := os.FSTimecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSTimecards = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsTimecards { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSTimecards = append(o.R.FSTimecards, rel) + } + } + + return nil +} + +// LoadFSTrapdata loads the organization's FSTrapdata into the .R struct +func (o *Organization) LoadFSTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSTrapdata = nil + + related, err := o.FSTrapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSTrapdata = related + return nil +} + +// LoadFSTrapdata loads the organization's FSTrapdata into the .R struct +func (os OrganizationSlice) LoadFSTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsTrapdata, err := os.FSTrapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSTrapdata = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsTrapdata { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSTrapdata = append(o.R.FSTrapdata, rel) + } + } + + return nil +} + +// LoadFSTraplocations loads the organization's FSTraplocations into the .R struct +func (o *Organization) LoadFSTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSTraplocations = nil + + related, err := o.FSTraplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSTraplocations = related + return nil +} + +// LoadFSTraplocations loads the organization's FSTraplocations into the .R struct +func (os OrganizationSlice) LoadFSTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsTraplocations, err := os.FSTraplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSTraplocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsTraplocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSTraplocations = append(o.R.FSTraplocations, rel) + } + } + + return nil +} + +// LoadFSTreatments loads the organization's FSTreatments into the .R struct +func (o *Organization) LoadFSTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSTreatments = nil + + related, err := o.FSTreatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSTreatments = related + return nil +} + +// LoadFSTreatments loads the organization's FSTreatments into the .R struct +func (os OrganizationSlice) LoadFSTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsTreatments, err := os.FSTreatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSTreatments = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsTreatments { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSTreatments = append(o.R.FSTreatments, rel) + } + } + + return nil +} + +// LoadFSTreatmentareas loads the organization's FSTreatmentareas into the .R struct +func (o *Organization) LoadFSTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSTreatmentareas = nil + + related, err := o.FSTreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSTreatmentareas = related + return nil +} + +// LoadFSTreatmentareas loads the organization's FSTreatmentareas into the .R struct +func (os OrganizationSlice) LoadFSTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsTreatmentareas, err := os.FSTreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSTreatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsTreatmentareas { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSTreatmentareas = append(o.R.FSTreatmentareas, rel) + } + } + + return nil +} + +// LoadFSZones loads the organization's FSZones into the .R struct +func (o *Organization) LoadFSZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSZones = nil + + related, err := o.FSZones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSZones = related + return nil +} + +// LoadFSZones loads the organization's FSZones into the .R struct +func (os OrganizationSlice) LoadFSZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsZones, err := os.FSZones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSZones = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsZones { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSZones = append(o.R.FSZones, rel) + } + } + + return nil +} + +// LoadFSZones2s loads the organization's FSZones2s into the .R struct +func (o *Organization) LoadFSZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FSZones2s = nil + + related, err := o.FSZones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FSZones2s = related + return nil +} + +// LoadFSZones2s loads the organization's FSZones2s into the .R struct +func (os OrganizationSlice) LoadFSZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fsZones2s, err := os.FSZones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FSZones2s = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fsZones2s { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.FSZones2s = append(o.R.FSZones2s, rel) + } + } + + return nil +} + +// LoadHistoryContainerrelates loads the organization's HistoryContainerrelates into the .R struct +func (o *Organization) LoadHistoryContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryContainerrelates = nil + + related, err := o.HistoryContainerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryContainerrelates = related + return nil +} + +// LoadHistoryContainerrelates loads the organization's HistoryContainerrelates into the .R struct +func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyContainerrelates, err := os.HistoryContainerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryContainerrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyContainerrelates { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryContainerrelates = append(o.R.HistoryContainerrelates, rel) + } + } + + return nil +} + +// LoadHistoryFieldscoutinglogs loads the organization's HistoryFieldscoutinglogs into the .R struct +func (o *Organization) LoadHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryFieldscoutinglogs = nil + + related, err := o.HistoryFieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryFieldscoutinglogs = related + return nil +} + +// LoadHistoryFieldscoutinglogs loads the organization's HistoryFieldscoutinglogs into the .R struct +func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyFieldscoutinglogs, err := os.HistoryFieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryFieldscoutinglogs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyFieldscoutinglogs { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryFieldscoutinglogs = append(o.R.HistoryFieldscoutinglogs, rel) + } + } + + return nil +} + +// LoadHistoryHabitatrelates loads the organization's HistoryHabitatrelates into the .R struct +func (o *Organization) LoadHistoryHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryHabitatrelates = nil + + related, err := o.HistoryHabitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryHabitatrelates = related + return nil +} + +// LoadHistoryHabitatrelates loads the organization's HistoryHabitatrelates into the .R struct +func (os OrganizationSlice) LoadHistoryHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyHabitatrelates, err := os.HistoryHabitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryHabitatrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyHabitatrelates { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryHabitatrelates = append(o.R.HistoryHabitatrelates, rel) + } + } + + return nil +} + +// LoadHistoryInspectionsamples loads the organization's HistoryInspectionsamples into the .R struct +func (o *Organization) LoadHistoryInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryInspectionsamples = nil + + related, err := o.HistoryInspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryInspectionsamples = related + return nil +} + +// LoadHistoryInspectionsamples loads the organization's HistoryInspectionsamples into the .R struct +func (os OrganizationSlice) LoadHistoryInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyInspectionsamples, err := os.HistoryInspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryInspectionsamples = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyInspectionsamples { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryInspectionsamples = append(o.R.HistoryInspectionsamples, rel) + } + } + + return nil +} + +// LoadHistoryInspectionsampledetails loads the organization's HistoryInspectionsampledetails into the .R struct +func (o *Organization) LoadHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryInspectionsampledetails = nil + + related, err := o.HistoryInspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryInspectionsampledetails = related + return nil +} + +// LoadHistoryInspectionsampledetails loads the organization's HistoryInspectionsampledetails into the .R struct +func (os OrganizationSlice) LoadHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyInspectionsampledetails, err := os.HistoryInspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryInspectionsampledetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyInspectionsampledetails { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryInspectionsampledetails = append(o.R.HistoryInspectionsampledetails, rel) + } + } + + return nil +} + +// LoadHistoryLinelocations loads the organization's HistoryLinelocations into the .R struct +func (o *Organization) LoadHistoryLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryLinelocations = nil + + related, err := o.HistoryLinelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryLinelocations = related + return nil +} + +// LoadHistoryLinelocations loads the organization's HistoryLinelocations into the .R struct +func (os OrganizationSlice) LoadHistoryLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyLinelocations, err := os.HistoryLinelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryLinelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyLinelocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryLinelocations = append(o.R.HistoryLinelocations, rel) + } + } + + return nil +} + +// LoadHistoryLocationtrackings loads the organization's HistoryLocationtrackings into the .R struct +func (o *Organization) LoadHistoryLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryLocationtrackings = nil + + related, err := o.HistoryLocationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryLocationtrackings = related + return nil +} + +// LoadHistoryLocationtrackings loads the organization's HistoryLocationtrackings into the .R struct +func (os OrganizationSlice) LoadHistoryLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyLocationtrackings, err := os.HistoryLocationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryLocationtrackings = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyLocationtrackings { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryLocationtrackings = append(o.R.HistoryLocationtrackings, rel) + } + } + + return nil +} + +// LoadHistoryMosquitoinspections loads the organization's HistoryMosquitoinspections into the .R struct +func (o *Organization) LoadHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryMosquitoinspections = nil + + related, err := o.HistoryMosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryMosquitoinspections = related + return nil +} + +// LoadHistoryMosquitoinspections loads the organization's HistoryMosquitoinspections into the .R struct +func (os OrganizationSlice) LoadHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyMosquitoinspections, err := os.HistoryMosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryMosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyMosquitoinspections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryMosquitoinspections = append(o.R.HistoryMosquitoinspections, rel) + } + } + + return nil +} + +// LoadHistoryPointlocations loads the organization's HistoryPointlocations into the .R struct +func (o *Organization) LoadHistoryPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryPointlocations = nil + + related, err := o.HistoryPointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryPointlocations = related + return nil +} + +// LoadHistoryPointlocations loads the organization's HistoryPointlocations into the .R struct +func (os OrganizationSlice) LoadHistoryPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyPointlocations, err := os.HistoryPointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryPointlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyPointlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryPointlocations = append(o.R.HistoryPointlocations, rel) + } + } + + return nil +} + +// LoadHistoryPolygonlocations loads the organization's HistoryPolygonlocations into the .R struct +func (o *Organization) LoadHistoryPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryPolygonlocations = nil + + related, err := o.HistoryPolygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryPolygonlocations = related + return nil +} + +// LoadHistoryPolygonlocations loads the organization's HistoryPolygonlocations into the .R struct +func (os OrganizationSlice) LoadHistoryPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyPolygonlocations, err := os.HistoryPolygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryPolygonlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyPolygonlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryPolygonlocations = append(o.R.HistoryPolygonlocations, rel) + } + } + + return nil +} + +// LoadHistoryPools loads the organization's HistoryPools into the .R struct +func (o *Organization) LoadHistoryPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryPools = nil + + related, err := o.HistoryPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryPools = related + return nil +} + +// LoadHistoryPools loads the organization's HistoryPools into the .R struct +func (os OrganizationSlice) LoadHistoryPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyPools, err := os.HistoryPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryPools = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyPools { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryPools = append(o.R.HistoryPools, rel) + } + } + + return nil +} + +// LoadHistoryPooldetails loads the organization's HistoryPooldetails into the .R struct +func (o *Organization) LoadHistoryPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryPooldetails = nil + + related, err := o.HistoryPooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryPooldetails = related + return nil +} + +// LoadHistoryPooldetails loads the organization's HistoryPooldetails into the .R struct +func (os OrganizationSlice) LoadHistoryPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyPooldetails, err := os.HistoryPooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryPooldetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyPooldetails { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryPooldetails = append(o.R.HistoryPooldetails, rel) + } + } + + return nil +} + +// LoadHistoryProposedtreatmentareas loads the organization's HistoryProposedtreatmentareas into the .R struct +func (o *Organization) LoadHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryProposedtreatmentareas = nil + + related, err := o.HistoryProposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryProposedtreatmentareas = related + return nil +} + +// LoadHistoryProposedtreatmentareas loads the organization's HistoryProposedtreatmentareas into the .R struct +func (os OrganizationSlice) LoadHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyProposedtreatmentareas, err := os.HistoryProposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryProposedtreatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyProposedtreatmentareas { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryProposedtreatmentareas = append(o.R.HistoryProposedtreatmentareas, rel) + } + } + + return nil +} + +// LoadHistoryQamosquitoinspections loads the organization's HistoryQamosquitoinspections into the .R struct +func (o *Organization) LoadHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryQamosquitoinspections = nil + + related, err := o.HistoryQamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryQamosquitoinspections = related + return nil +} + +// LoadHistoryQamosquitoinspections loads the organization's HistoryQamosquitoinspections into the .R struct +func (os OrganizationSlice) LoadHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyQamosquitoinspections, err := os.HistoryQamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryQamosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyQamosquitoinspections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryQamosquitoinspections = append(o.R.HistoryQamosquitoinspections, rel) + } + } + + return nil +} + +// LoadHistoryRodentlocations loads the organization's HistoryRodentlocations into the .R struct +func (o *Organization) LoadHistoryRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryRodentlocations = nil + + related, err := o.HistoryRodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryRodentlocations = related + return nil +} + +// LoadHistoryRodentlocations loads the organization's HistoryRodentlocations into the .R struct +func (os OrganizationSlice) LoadHistoryRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyRodentlocations, err := os.HistoryRodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryRodentlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyRodentlocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryRodentlocations = append(o.R.HistoryRodentlocations, rel) + } + } + + return nil +} + +// LoadHistorySamplecollections loads the organization's HistorySamplecollections into the .R struct +func (o *Organization) LoadHistorySamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistorySamplecollections = nil + + related, err := o.HistorySamplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistorySamplecollections = related + return nil +} + +// LoadHistorySamplecollections loads the organization's HistorySamplecollections into the .R struct +func (os OrganizationSlice) LoadHistorySamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historySamplecollections, err := os.HistorySamplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistorySamplecollections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historySamplecollections { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistorySamplecollections = append(o.R.HistorySamplecollections, rel) + } + } + + return nil +} + +// LoadHistorySamplelocations loads the organization's HistorySamplelocations into the .R struct +func (o *Organization) LoadHistorySamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistorySamplelocations = nil + + related, err := o.HistorySamplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistorySamplelocations = related + return nil +} + +// LoadHistorySamplelocations loads the organization's HistorySamplelocations into the .R struct +func (os OrganizationSlice) LoadHistorySamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historySamplelocations, err := os.HistorySamplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistorySamplelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historySamplelocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistorySamplelocations = append(o.R.HistorySamplelocations, rel) + } + } + + return nil +} + +// LoadHistoryServicerequests loads the organization's HistoryServicerequests into the .R struct +func (o *Organization) LoadHistoryServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryServicerequests = nil + + related, err := o.HistoryServicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryServicerequests = related + return nil +} + +// LoadHistoryServicerequests loads the organization's HistoryServicerequests into the .R struct +func (os OrganizationSlice) LoadHistoryServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyServicerequests, err := os.HistoryServicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryServicerequests = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyServicerequests { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryServicerequests = append(o.R.HistoryServicerequests, rel) + } + } + + return nil +} + +// LoadHistorySpeciesabundances loads the organization's HistorySpeciesabundances into the .R struct +func (o *Organization) LoadHistorySpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistorySpeciesabundances = nil + + related, err := o.HistorySpeciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistorySpeciesabundances = related + return nil +} + +// LoadHistorySpeciesabundances loads the organization's HistorySpeciesabundances into the .R struct +func (os OrganizationSlice) LoadHistorySpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historySpeciesabundances, err := os.HistorySpeciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistorySpeciesabundances = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historySpeciesabundances { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistorySpeciesabundances = append(o.R.HistorySpeciesabundances, rel) + } + } + + return nil +} + +// LoadHistoryStormdrains loads the organization's HistoryStormdrains into the .R struct +func (o *Organization) LoadHistoryStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryStormdrains = nil + + related, err := o.HistoryStormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryStormdrains = related + return nil +} + +// LoadHistoryStormdrains loads the organization's HistoryStormdrains into the .R struct +func (os OrganizationSlice) LoadHistoryStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyStormdrains, err := os.HistoryStormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryStormdrains = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyStormdrains { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryStormdrains = append(o.R.HistoryStormdrains, rel) + } + } + + return nil +} + +// LoadHistoryTimecards loads the organization's HistoryTimecards into the .R struct +func (o *Organization) LoadHistoryTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryTimecards = nil + + related, err := o.HistoryTimecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryTimecards = related + return nil +} + +// LoadHistoryTimecards loads the organization's HistoryTimecards into the .R struct +func (os OrganizationSlice) LoadHistoryTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyTimecards, err := os.HistoryTimecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryTimecards = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyTimecards { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryTimecards = append(o.R.HistoryTimecards, rel) + } + } + + return nil +} + +// LoadHistoryTrapdata loads the organization's HistoryTrapdata into the .R struct +func (o *Organization) LoadHistoryTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryTrapdata = nil + + related, err := o.HistoryTrapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryTrapdata = related + return nil +} + +// LoadHistoryTrapdata loads the organization's HistoryTrapdata into the .R struct +func (os OrganizationSlice) LoadHistoryTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyTrapdata, err := os.HistoryTrapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryTrapdata = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyTrapdata { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryTrapdata = append(o.R.HistoryTrapdata, rel) + } + } + + return nil +} + +// LoadHistoryTraplocations loads the organization's HistoryTraplocations into the .R struct +func (o *Organization) LoadHistoryTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryTraplocations = nil + + related, err := o.HistoryTraplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryTraplocations = related + return nil +} + +// LoadHistoryTraplocations loads the organization's HistoryTraplocations into the .R struct +func (os OrganizationSlice) LoadHistoryTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyTraplocations, err := os.HistoryTraplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryTraplocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyTraplocations { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryTraplocations = append(o.R.HistoryTraplocations, rel) + } + } + + return nil +} + +// LoadHistoryTreatments loads the organization's HistoryTreatments into the .R struct +func (o *Organization) LoadHistoryTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryTreatments = nil + + related, err := o.HistoryTreatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryTreatments = related + return nil +} + +// LoadHistoryTreatments loads the organization's HistoryTreatments into the .R struct +func (os OrganizationSlice) LoadHistoryTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyTreatments, err := os.HistoryTreatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryTreatments = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyTreatments { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryTreatments = append(o.R.HistoryTreatments, rel) + } + } + + return nil +} + +// LoadHistoryTreatmentareas loads the organization's HistoryTreatmentareas into the .R struct +func (o *Organization) LoadHistoryTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryTreatmentareas = nil + + related, err := o.HistoryTreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryTreatmentareas = related + return nil +} + +// LoadHistoryTreatmentareas loads the organization's HistoryTreatmentareas into the .R struct +func (os OrganizationSlice) LoadHistoryTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyTreatmentareas, err := os.HistoryTreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryTreatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyTreatmentareas { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryTreatmentareas = append(o.R.HistoryTreatmentareas, rel) + } + } + + return nil +} + +// LoadHistoryZones loads the organization's HistoryZones into the .R struct +func (o *Organization) LoadHistoryZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryZones = nil + + related, err := o.HistoryZones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryZones = related + return nil +} + +// LoadHistoryZones loads the organization's HistoryZones into the .R struct +func (os OrganizationSlice) LoadHistoryZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyZones, err := os.HistoryZones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryZones = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyZones { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryZones = append(o.R.HistoryZones, rel) + } + } + + return nil +} + +// LoadHistoryZones2s loads the organization's HistoryZones2s into the .R struct +func (o *Organization) LoadHistoryZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.HistoryZones2s = nil + + related, err := o.HistoryZones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.HistoryZones2s = related + return nil +} + +// LoadHistoryZones2s loads the organization's HistoryZones2s into the .R struct +func (os OrganizationSlice) LoadHistoryZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + historyZones2s, err := os.HistoryZones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.HistoryZones2s = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range historyZones2s { + + if !rel.OrganizationID.IsValue() { + continue + } + if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + continue + } + + rel.R.Organization = o + + o.R.HistoryZones2s = append(o.R.HistoryZones2s, rel) + } + } + + return nil +} + // LoadUser loads the organization's User into the .R struct func (o *Organization) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -643,8 +10442,62 @@ func (os OrganizationSlice) LoadUser(ctx context.Context, exec bob.Executor, mod } type organizationJoins[Q dialect.Joinable] struct { - typ string - User modAs[Q, userColumns] + typ string + FSContainerrelates modAs[Q, fsContainerrelateColumns] + FSFieldscoutinglogs modAs[Q, fsFieldscoutinglogColumns] + FSHabitatrelates modAs[Q, fsHabitatrelateColumns] + FSInspectionsamples modAs[Q, fsInspectionsampleColumns] + FSInspectionsampledetails modAs[Q, fsInspectionsampledetailColumns] + FSLinelocations modAs[Q, fsLinelocationColumns] + FSLocationtrackings modAs[Q, fsLocationtrackingColumns] + FSMosquitoinspections modAs[Q, fsMosquitoinspectionColumns] + FSPointlocations modAs[Q, fsPointlocationColumns] + FSPolygonlocations modAs[Q, fsPolygonlocationColumns] + FSPools modAs[Q, fsPoolColumns] + FSPooldetails modAs[Q, fsPooldetailColumns] + FSProposedtreatmentareas modAs[Q, fsProposedtreatmentareaColumns] + FSQamosquitoinspections modAs[Q, fsQamosquitoinspectionColumns] + FSRodentlocations modAs[Q, fsRodentlocationColumns] + FSSamplecollections modAs[Q, fsSamplecollectionColumns] + FSSamplelocations modAs[Q, fsSamplelocationColumns] + FSServicerequests modAs[Q, fsServicerequestColumns] + FSSpeciesabundances modAs[Q, fsSpeciesabundanceColumns] + FSStormdrains modAs[Q, fsStormdrainColumns] + FSTimecards modAs[Q, fsTimecardColumns] + FSTrapdata modAs[Q, fsTrapdatumColumns] + FSTraplocations modAs[Q, fsTraplocationColumns] + FSTreatments modAs[Q, fsTreatmentColumns] + FSTreatmentareas modAs[Q, fsTreatmentareaColumns] + FSZones modAs[Q, fsZoneColumns] + FSZones2s modAs[Q, fsZones2Columns] + HistoryContainerrelates modAs[Q, historyContainerrelateColumns] + HistoryFieldscoutinglogs modAs[Q, historyFieldscoutinglogColumns] + HistoryHabitatrelates modAs[Q, historyHabitatrelateColumns] + HistoryInspectionsamples modAs[Q, historyInspectionsampleColumns] + HistoryInspectionsampledetails modAs[Q, historyInspectionsampledetailColumns] + HistoryLinelocations modAs[Q, historyLinelocationColumns] + HistoryLocationtrackings modAs[Q, historyLocationtrackingColumns] + HistoryMosquitoinspections modAs[Q, historyMosquitoinspectionColumns] + HistoryPointlocations modAs[Q, historyPointlocationColumns] + HistoryPolygonlocations modAs[Q, historyPolygonlocationColumns] + HistoryPools modAs[Q, historyPoolColumns] + HistoryPooldetails modAs[Q, historyPooldetailColumns] + HistoryProposedtreatmentareas modAs[Q, historyProposedtreatmentareaColumns] + HistoryQamosquitoinspections modAs[Q, historyQamosquitoinspectionColumns] + HistoryRodentlocations modAs[Q, historyRodentlocationColumns] + HistorySamplecollections modAs[Q, historySamplecollectionColumns] + HistorySamplelocations modAs[Q, historySamplelocationColumns] + HistoryServicerequests modAs[Q, historyServicerequestColumns] + HistorySpeciesabundances modAs[Q, historySpeciesabundanceColumns] + HistoryStormdrains modAs[Q, historyStormdrainColumns] + HistoryTimecards modAs[Q, historyTimecardColumns] + HistoryTrapdata modAs[Q, historyTrapdatumColumns] + HistoryTraplocations modAs[Q, historyTraplocationColumns] + HistoryTreatments modAs[Q, historyTreatmentColumns] + HistoryTreatmentareas modAs[Q, historyTreatmentareaColumns] + HistoryZones modAs[Q, historyZoneColumns] + HistoryZones2s modAs[Q, historyZones2Columns] + User modAs[Q, userColumns] } func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] { @@ -654,6 +10507,762 @@ 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, + FSContainerrelates: modAs[Q, fsContainerrelateColumns]{ + c: FSContainerrelates.Columns, + f: func(to fsContainerrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSContainerrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSFieldscoutinglogs: modAs[Q, fsFieldscoutinglogColumns]{ + c: FSFieldscoutinglogs.Columns, + f: func(to fsFieldscoutinglogColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSFieldscoutinglogs.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSHabitatrelates: modAs[Q, fsHabitatrelateColumns]{ + c: FSHabitatrelates.Columns, + f: func(to fsHabitatrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSHabitatrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSInspectionsamples: modAs[Q, fsInspectionsampleColumns]{ + c: FSInspectionsamples.Columns, + f: func(to fsInspectionsampleColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSInspectionsamples.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSInspectionsampledetails: modAs[Q, fsInspectionsampledetailColumns]{ + c: FSInspectionsampledetails.Columns, + f: func(to fsInspectionsampledetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSInspectionsampledetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSLinelocations: modAs[Q, fsLinelocationColumns]{ + c: FSLinelocations.Columns, + f: func(to fsLinelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSLinelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSLocationtrackings: modAs[Q, fsLocationtrackingColumns]{ + c: FSLocationtrackings.Columns, + f: func(to fsLocationtrackingColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSLocationtrackings.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSMosquitoinspections: modAs[Q, fsMosquitoinspectionColumns]{ + c: FSMosquitoinspections.Columns, + f: func(to fsMosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSMosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSPointlocations: modAs[Q, fsPointlocationColumns]{ + c: FSPointlocations.Columns, + f: func(to fsPointlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSPointlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSPolygonlocations: modAs[Q, fsPolygonlocationColumns]{ + c: FSPolygonlocations.Columns, + f: func(to fsPolygonlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSPolygonlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSPools: modAs[Q, fsPoolColumns]{ + c: FSPools.Columns, + f: func(to fsPoolColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSPools.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSPooldetails: modAs[Q, fsPooldetailColumns]{ + c: FSPooldetails.Columns, + f: func(to fsPooldetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSPooldetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSProposedtreatmentareas: modAs[Q, fsProposedtreatmentareaColumns]{ + c: FSProposedtreatmentareas.Columns, + f: func(to fsProposedtreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSProposedtreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSQamosquitoinspections: modAs[Q, fsQamosquitoinspectionColumns]{ + c: FSQamosquitoinspections.Columns, + f: func(to fsQamosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSQamosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSRodentlocations: modAs[Q, fsRodentlocationColumns]{ + c: FSRodentlocations.Columns, + f: func(to fsRodentlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSRodentlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSSamplecollections: modAs[Q, fsSamplecollectionColumns]{ + c: FSSamplecollections.Columns, + f: func(to fsSamplecollectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSSamplecollections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSSamplelocations: modAs[Q, fsSamplelocationColumns]{ + c: FSSamplelocations.Columns, + f: func(to fsSamplelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSSamplelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSServicerequests: modAs[Q, fsServicerequestColumns]{ + c: FSServicerequests.Columns, + f: func(to fsServicerequestColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSServicerequests.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSSpeciesabundances: modAs[Q, fsSpeciesabundanceColumns]{ + c: FSSpeciesabundances.Columns, + f: func(to fsSpeciesabundanceColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSSpeciesabundances.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSStormdrains: modAs[Q, fsStormdrainColumns]{ + c: FSStormdrains.Columns, + f: func(to fsStormdrainColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSStormdrains.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSTimecards: modAs[Q, fsTimecardColumns]{ + c: FSTimecards.Columns, + f: func(to fsTimecardColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSTimecards.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSTrapdata: modAs[Q, fsTrapdatumColumns]{ + c: FSTrapdata.Columns, + f: func(to fsTrapdatumColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSTrapdata.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSTraplocations: modAs[Q, fsTraplocationColumns]{ + c: FSTraplocations.Columns, + f: func(to fsTraplocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSTraplocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSTreatments: modAs[Q, fsTreatmentColumns]{ + c: FSTreatments.Columns, + f: func(to fsTreatmentColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSTreatments.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSTreatmentareas: modAs[Q, fsTreatmentareaColumns]{ + c: FSTreatmentareas.Columns, + f: func(to fsTreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSTreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSZones: modAs[Q, fsZoneColumns]{ + c: FSZones.Columns, + f: func(to fsZoneColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSZones.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + FSZones2s: modAs[Q, fsZones2Columns]{ + c: FSZones2s.Columns, + f: func(to fsZones2Columns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FSZones2s.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryContainerrelates: modAs[Q, historyContainerrelateColumns]{ + c: HistoryContainerrelates.Columns, + f: func(to historyContainerrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryContainerrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryFieldscoutinglogs: modAs[Q, historyFieldscoutinglogColumns]{ + c: HistoryFieldscoutinglogs.Columns, + f: func(to historyFieldscoutinglogColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryFieldscoutinglogs.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryHabitatrelates: modAs[Q, historyHabitatrelateColumns]{ + c: HistoryHabitatrelates.Columns, + f: func(to historyHabitatrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryHabitatrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryInspectionsamples: modAs[Q, historyInspectionsampleColumns]{ + c: HistoryInspectionsamples.Columns, + f: func(to historyInspectionsampleColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryInspectionsamples.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryInspectionsampledetails: modAs[Q, historyInspectionsampledetailColumns]{ + c: HistoryInspectionsampledetails.Columns, + f: func(to historyInspectionsampledetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryInspectionsampledetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryLinelocations: modAs[Q, historyLinelocationColumns]{ + c: HistoryLinelocations.Columns, + f: func(to historyLinelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryLinelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryLocationtrackings: modAs[Q, historyLocationtrackingColumns]{ + c: HistoryLocationtrackings.Columns, + f: func(to historyLocationtrackingColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryLocationtrackings.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryMosquitoinspections: modAs[Q, historyMosquitoinspectionColumns]{ + c: HistoryMosquitoinspections.Columns, + f: func(to historyMosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryMosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryPointlocations: modAs[Q, historyPointlocationColumns]{ + c: HistoryPointlocations.Columns, + f: func(to historyPointlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryPointlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryPolygonlocations: modAs[Q, historyPolygonlocationColumns]{ + c: HistoryPolygonlocations.Columns, + f: func(to historyPolygonlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryPolygonlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryPools: modAs[Q, historyPoolColumns]{ + c: HistoryPools.Columns, + f: func(to historyPoolColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryPools.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryPooldetails: modAs[Q, historyPooldetailColumns]{ + c: HistoryPooldetails.Columns, + f: func(to historyPooldetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryPooldetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryProposedtreatmentareas: modAs[Q, historyProposedtreatmentareaColumns]{ + c: HistoryProposedtreatmentareas.Columns, + f: func(to historyProposedtreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryProposedtreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryQamosquitoinspections: modAs[Q, historyQamosquitoinspectionColumns]{ + c: HistoryQamosquitoinspections.Columns, + f: func(to historyQamosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryQamosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryRodentlocations: modAs[Q, historyRodentlocationColumns]{ + c: HistoryRodentlocations.Columns, + f: func(to historyRodentlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryRodentlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistorySamplecollections: modAs[Q, historySamplecollectionColumns]{ + c: HistorySamplecollections.Columns, + f: func(to historySamplecollectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistorySamplecollections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistorySamplelocations: modAs[Q, historySamplelocationColumns]{ + c: HistorySamplelocations.Columns, + f: func(to historySamplelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistorySamplelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryServicerequests: modAs[Q, historyServicerequestColumns]{ + c: HistoryServicerequests.Columns, + f: func(to historyServicerequestColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryServicerequests.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistorySpeciesabundances: modAs[Q, historySpeciesabundanceColumns]{ + c: HistorySpeciesabundances.Columns, + f: func(to historySpeciesabundanceColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistorySpeciesabundances.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryStormdrains: modAs[Q, historyStormdrainColumns]{ + c: HistoryStormdrains.Columns, + f: func(to historyStormdrainColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryStormdrains.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryTimecards: modAs[Q, historyTimecardColumns]{ + c: HistoryTimecards.Columns, + f: func(to historyTimecardColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryTimecards.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryTrapdata: modAs[Q, historyTrapdatumColumns]{ + c: HistoryTrapdata.Columns, + f: func(to historyTrapdatumColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryTrapdata.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryTraplocations: modAs[Q, historyTraplocationColumns]{ + c: HistoryTraplocations.Columns, + f: func(to historyTraplocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryTraplocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryTreatments: modAs[Q, historyTreatmentColumns]{ + c: HistoryTreatments.Columns, + f: func(to historyTreatmentColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryTreatments.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryTreatmentareas: modAs[Q, historyTreatmentareaColumns]{ + c: HistoryTreatmentareas.Columns, + f: func(to historyTreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryTreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryZones: modAs[Q, historyZoneColumns]{ + c: HistoryZones.Columns, + f: func(to historyZoneColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryZones.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + HistoryZones2s: modAs[Q, historyZones2Columns]{ + c: HistoryZones2s.Columns, + f: func(to historyZones2Columns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, HistoryZones2s.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, User: modAs[Q, userColumns]{ c: Users.Columns, f: func(to userColumns) bob.Mod[Q] { diff --git a/sql/org_by_oauth_id.bob.go b/sql/org_by_oauth_id.bob.go new file mode 100644 index 00000000..c98fb58a --- /dev/null +++ b/sql/org_by_oauth_id.bob.go @@ -0,0 +1,96 @@ +// 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 sql + +import ( + "context" + _ "embed" + "io" + "iter" + + "github.com/aarondl/opt/null" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/dialect/psql/dialect" + "github.com/stephenafamo/bob/orm" + "github.com/stephenafamo/scan" +) + +//go:embed org_by_oauth_id.bob.sql +var formattedQueries_org_by_oauth_id string + +var orgByOauthIdSQL = formattedQueries_org_by_oauth_id[150:363] + +type OrgByOauthIdQuery = orm.ModQuery[*dialect.SelectQuery, orgByOauthId, OrgByOauthIdRow, []OrgByOauthIdRow, orgByOauthIdTransformer] + +func OrgByOauthId(ID int32) *OrgByOauthIdQuery { + var expressionTypArgs orgByOauthId + + expressionTypArgs.ID = psql.Arg(ID) + + return &OrgByOauthIdQuery{ + Query: orm.Query[orgByOauthId, OrgByOauthIdRow, []OrgByOauthIdRow, orgByOauthIdTransformer]{ + ExecQuery: orm.ExecQuery[orgByOauthId]{ + BaseQuery: bob.BaseQuery[orgByOauthId]{ + Expression: expressionTypArgs, + Dialect: dialect.Dialect, + QueryType: bob.QueryTypeSelect, + }, + }, + Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (OrgByOauthIdRow, error)) { + return func(row *scan.Row) (any, error) { + var t OrgByOauthIdRow + row.ScheduleScanByIndex(0, &t.OrganizationID) + row.ScheduleScanByIndex(1, &t.ArcgisID) + row.ScheduleScanByIndex(2, &t.FieldseekerURL) + return &t, nil + }, func(v any) (OrgByOauthIdRow, error) { + return *(v.(*OrgByOauthIdRow)), nil + } + }, + }, + Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) { + q.AppendSelect(expressionTypArgs.subExpr(7, 94)) + q.SetTable(expressionTypArgs.subExpr(100, 196)) + q.AppendWhere(expressionTypArgs.subExpr(203, 213)) + }), + } +} + +type OrgByOauthIdRow = struct { + OrganizationID int32 `db:"organization_id"` + ArcgisID null.Val[string] `db:"arcgis_id"` + FieldseekerURL null.Val[string] `db:"fieldseeker_url"` +} + +type orgByOauthIdTransformer = bob.SliceTransformer[OrgByOauthIdRow, []OrgByOauthIdRow] + +type orgByOauthId struct { + ID bob.Expression +} + +func (o orgByOauthId) args() iter.Seq[orm.ArgWithPosition] { + return func(yield func(arg orm.ArgWithPosition) bool) { + if !yield(orm.ArgWithPosition{ + Name: "id", + Start: 211, + Stop: 213, + Expression: o.ID, + }) { + return + } + } +} + +func (o orgByOauthId) raw(from, to int) string { + return orgByOauthIdSQL[from:to] +} + +func (o orgByOauthId) subExpr(from, to int) bob.Expression { + return orm.ArgsToExpression(orgByOauthIdSQL, from, to, o.args()) +} + +func (o orgByOauthId) WriteSQL(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + return o.subExpr(0, len(orgByOauthIdSQL)).WriteSQL(ctx, w, d, start) +} diff --git a/sql/org_by_oauth_id.bob.sql b/sql/org_by_oauth_id.bob.sql new file mode 100644 index 00000000..0fbd5297 --- /dev/null +++ b/sql/org_by_oauth_id.bob.sql @@ -0,0 +1,9 @@ +-- 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. + +-- OrgByOauthId +SELECT o.id AS organization_id, o.arcgis_id AS arcgis_id, o.fieldseeker_url AS fieldseeker_url +FROM oauth_token ot +JOIN user_ u ON ot.user_id = u.id +JOIN organization o ON u.organization_id = o.id +WHERE ot.id = $1; diff --git a/sql/org_by_oauth_id.bob_test.go b/sql/org_by_oauth_id.bob_test.go new file mode 100644 index 00000000..e860db1c --- /dev/null +++ b/sql/org_by_oauth_id.bob_test.go @@ -0,0 +1,103 @@ +// 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 sql + +import ( + "context" + "fmt" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + testutils "github.com/stephenafamo/bob/test/utils" +) + +func TestOrgByOauthId(t *testing.T) { + t.Run("Base", func(t *testing.T) { + var sb strings.Builder + + query := OrgByOauthId(random_int32(nil)) + + if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { + t.Fatal(err) + } + + if diff := cmp.Diff(orgByOauthIdSQL, sb.String()); diff != "" { + t.Fatalf("unexpected result (-got +want):\n%s", diff) + } + }) + + t.Run("Mod", func(t *testing.T) { + var sb strings.Builder + + query := OrgByOauthId(random_int32(nil)) + + if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { + t.Fatal(err) + } + + queryDiff, err := testutils.QueryDiff(orgByOauthIdSQL, sb.String(), formatQuery) + if err != nil { + t.Fatal(err) + } + if queryDiff != "" { + fmt.Println(sb.String()) + t.Fatalf("unexpected result (-got +want):\n%s", queryDiff) + } + }) + + t.Run("Scanning", func(t *testing.T) { + if testDB == nil { + t.Skip("skipping test, no DSN provided") + } + + ctxTx, cancel := context.WithCancel(t.Context()) + defer cancel() + + tx, err := testDB.Begin(ctxTx) + if err != nil { + t.Fatalf("Error starting transaction: %v", err) + } + + defer func() { + if err := tx.Rollback(ctxTx); err != nil { + t.Fatalf("Error rolling back transaction: %v", err) + } + }() + + query, args, err := bob.Build(ctxTx, psql.Select(OrgByOauthId(random_int32(nil)))) + if err != nil { + t.Fatal(err) + } + + rows, err := tx.QueryContext(ctxTx, query, args...) + if err != nil { + t.Fatal(err) + } + defer rows.Close() + + columns, err := rows.Columns() + if err != nil { + t.Fatal(err) + } + + if len(columns) != 3 { + t.Fatalf("expected %d columns, got %d", 3, len(columns)) + } + + if columns[0] != "organization_id" { + t.Fatalf("expected column %d to be %s, got %s", 0, "organization_id", columns[0]) + } + + if columns[1] != "arcgis_id" { + t.Fatalf("expected column %d to be %s, got %s", 1, "arcgis_id", columns[1]) + } + + if columns[2] != "fieldseeker_url" { + t.Fatalf("expected column %d to be %s, got %s", 2, "fieldseeker_url", columns[2]) + } + }) +} diff --git a/sql/org_by_oauth_id.sql b/sql/org_by_oauth_id.sql new file mode 100644 index 00000000..d38ff980 --- /dev/null +++ b/sql/org_by_oauth_id.sql @@ -0,0 +1,6 @@ +-- OrgByOauthId +SELECT o.id AS organization_id, o.arcgis_id AS arcgis_id, o.fieldseeker_url AS fieldseeker_url +FROM oauth_token ot +JOIN user_ u ON ot.user_id = u.id +JOIN organization o ON u.organization_id = o.id +WHERE ot.id = $1